Data types
What's the Output?
Code Crackers
Variable Vault
Loop-de-Loop
100

This data type is used to store whole numbers without decimals in C#.

What is int

100

Console.WriteLine(3 + 5);


what is 8?

100

int x = 10;  

if (x > 5)  

{

     Console.WriteLine("Greater than 5");  

}

else  

{

     Console.WriteLine("Less than or equal to 5");

}

What is Greater than 5?

100

string firstName = "John";  

string lastName = "Doe";  

string fullName = firstName + " " + lastName;  

Console.WriteLine(fullName);


What is John Doe?

100

for (int i = 1; i <= 5; i++)  

{

     Console.Write(i + " ");

}

What is 1 2 3 4 5 ?

200

This floating-point data type is commonly used in C# to store numbers with decimals but offers less precision than double.

What is float

200

Console.WriteLine(10 - 4);


what is 6?

200

int x = 8;  

if (x % 2 == 0)  

{

     Console.WriteLine("Even");  

}

else  

{

     Console.WriteLine("Odd");

}

What is Even?

200

bool isSunny = true;  

bool isWeekend = false;  

bool canGoOutside = isSunny && isWeekend;  

Console.WriteLine(canGoOutside);


What is false?

200

for (int i = 5; i > 0; i--)  

{

     Console.Write(i + " ");

}


What is 5 4 3 2 1 ?

300

This data type can store a single Unicode character and is enclosed in single quotes.

What is char?

300

int x = 9;  

int y = 5;  

Console.WriteLine($"{x * y}");


What is 45?

300

int a = 4;  

int b = 6;  

if (a + b > 10)  

{

     Console.WriteLine("Sum is greater than 10"); 

}
else 

{

     Console.WriteLine("Sum is 10 or less");

}

What is sum is 10 or less?

300

double price = 49.99;  

double discount = 10.0;  

double finalPrice = price - (price * discount / 100);  

Console.WriteLine(finalPrice);


What is 44.99?

300

for (int i = 1; i <= 10; i += 2)  

{

     Console.Write(i + " ");

}

What is 1 3 5 7 9 ?)

400

This immutable data type in C# represents a sequence of characters.

What is string?

400

float a = 2;  

float b = 3;  

float c = a * b + b / a;  

Console.WriteLine(c);


what is 7.5?

400

int num = 7;  

if (num % 3 == 0)  

{

     Console.WriteLine("Divisible by 3");

}

else if (num % 5 == 0)  

{

     Console.WriteLine("Divisible by 5");  

}

else  

{

     Console.WriteLine("Not divisible by 3 or 5");

}

What is Not divisible by 3 or 5?

400

double pi = 3.14;  

double radius = 2.5;  

double area = pi * radius * radius;  

Console.WriteLine(area);


What is 19.625?

400

int result = 1;  

for (int i = 3; i >= 1; i--)  

     result *= i; 

}

Console.WriteLine(result);


What is 6?

500

This data type can store one of only two possible values.

What is bool

500

int a = 2;  

int b = 3;  

int result = (a + b) * (b - a);  

Console.WriteLine(result);


What is 5?

500

int x = 12;  

int y = 4;  

if (x % y == 0 && x / y > 2)  

{

     Console.WriteLine("Perfectly divisible and > 2");

}

else  

{

     Console.WriteLine("Not divisible or <= 2");

}

What is Perfectly divisible and > 2?

500

int apples = 4;  

int bananas = 6;  

int fruits = apples + bananas;  

Console.WriteLine(fruits);


What is 10?

500

int x = 2;  

for (int i = 1; i <= 3; i++) 

{

    x *= i; 

}

Console.WriteLine(x);


What is 12?