Category: C# Tutorial

C# Break and Continue

C# Break and Continue

C# Break and Continue In C#, break and continue are loop control statements used to change the normal flow of loops (for, while, do-while, foreach, and switch). break Statement The break statement is used...

C# For Loop

C# For Loop

C# For Loop The for loop in C# is used to repeat a block of code a specific number of times. It is best when you know in advance how many iterations are required....

C# While Loop

C# While Loop

C# While Loop The while loop in C# is used to repeat a block of code as long as a condition is true. It is best used when you don’t know in advance how...

C# Switch Statement

C# Switch Statement

C# Switch Statement The switch statement in C# is used to execute one block of code from many choices. It is a clean alternative to long if…else if chains when comparing a single value....

C# If … Else

C# If … Else

C# If … Else The if…else statement in C# is used to make decisions. It allows your program to execute different code blocks based on conditions.  Basic if Statement

  ✔ Executes only...

C# Booleans

C# Booleans

C# Booleans In C#, booleans are used to store true or false values. They are mainly used in conditions, comparisons, and decision-making statements.  Boolean Data Type The boolean data type in C# is called...

C# Strings

C# Strings

C# Strings In C#, a string is used to store text. Strings are objects of the String class and are immutable, meaning once created, they cannot be changed.  Declaring Strings

 String Output

...

C# Math

C# Math

C# Math C# provides the Math class (in the System namespace) to perform common mathematical operations like rounding, power, square root, min/max, and trigonometry.  Basic Math Operations

   Math Class (System.Math) ✔ Common...

C# Operators

C# Operators

C# Operators Operators in C# are symbols used to perform operations on variables and values, such as arithmetic calculations, comparisons, and logical decisions.  Types of Operators in C# Arithmetic Operators Assignment Operators Comparison (Relational)...

C# User Input

C# User Input

C# User Input In C#, user input is commonly taken from the keyboard using the Console.ReadLine() method. 🔹 Basic User Input

  🔹 Input with Numbers (Type Casting Required) Console.ReadLine() always returns a...