C# Note
Note
“Hello world”
• Console.WriteLine()
Vs
• Console.Write()
• Console.ReadLine()
Or
• Console.ReadKey() -
for avoid closing the
Console application suddenly.
Data Types
• The data type tells the C# compiler what kind of value a variable can hold.
• C# includes many in-built data types for different kinds of data, e.g. String,
int, double, char, bool, etc.
1
, Data Types & Variable Declaration
Displaying Variables on Console Application
Getting String Input from User
2
,Getting Integer Input from User (I)
Getting Integer Input from User (II)
3
, Basic Operators
• An Operator is a symbol that tells the compiler to perform specific
mathematical or logical manipulations.
• C# has rich set of built-in operators and provides the following type of
operators.
1) Arithmetic Operators
2) Relational operators
3) Logical Operators
4) Assignment Operators
C# Loops
• There may be situation, when you need to execute a block of code several
number of times.
• In general, the statements are executed sequentially; The first statement in
a function is executed first, followed by the second and so on.
• C# provides following types of loops to handle looping requirement.
01. while loop
02. for loop
03. do while loop.
04. nested loops
4
Note
“Hello world”
• Console.WriteLine()
Vs
• Console.Write()
• Console.ReadLine()
Or
• Console.ReadKey() -
for avoid closing the
Console application suddenly.
Data Types
• The data type tells the C# compiler what kind of value a variable can hold.
• C# includes many in-built data types for different kinds of data, e.g. String,
int, double, char, bool, etc.
1
, Data Types & Variable Declaration
Displaying Variables on Console Application
Getting String Input from User
2
,Getting Integer Input from User (I)
Getting Integer Input from User (II)
3
, Basic Operators
• An Operator is a symbol that tells the compiler to perform specific
mathematical or logical manipulations.
• C# has rich set of built-in operators and provides the following type of
operators.
1) Arithmetic Operators
2) Relational operators
3) Logical Operators
4) Assignment Operators
C# Loops
• There may be situation, when you need to execute a block of code several
number of times.
• In general, the statements are executed sequentially; The first statement in
a function is executed first, followed by the second and so on.
• C# provides following types of loops to handle looping requirement.
01. while loop
02. for loop
03. do while loop.
04. nested loops
4