Data types define what information is stored
The most used of them are:
| int | Whole number. |
|---|---|
| double | Floating point number. |
| string | Sequence of characters (text). |
| char | Represents a single symbol. |
| bool | Can have only 2 values - true or false. |
Console.ReadLine(); - reading data.Console.WriteLine(); - printing data.Make sure using System; is added in order to use them.
The variables are used to store data of certain type.
Their value can be changed any time.
Example of variables definitions:
Write a program that prints "Starting the program." Afterwards it must read a word and print it back.
Solution:
Input:
Output:
Explanation:
using System; is added so Console.ReadLine()
and Console.WriteLine() can be used.Console.WriteLine() is used to print message to the user.