0% found this document useful (0 votes)
4 views2 pages

Cheat Shit

This document provides examples of basic C# code snippets including printing to the console, data types, operations, logical statements, comparisons, if/else statements, and for loops. It demonstrates how to declare and assign variables, get user input, perform calculations, check conditions, and iterate through loops. The snippets cover many fundamental programming concepts in C# like strings, integers, booleans, concatenation, parsing, arithmetic operators, and conditional logic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Cheat Shit

This document provides examples of basic C# code snippets including printing to the console, data types, operations, logical statements, comparisons, if/else statements, and for loops. It demonstrates how to declare and assign variables, get user input, perform calculations, check conditions, and iterate through loops. The snippets cover many fundamental programming concepts in C# like strings, integers, booleans, concatenation, parsing, arithmetic operators, and conditional logic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Console.

WriteLine("Hello World"); - printing


Console.WriteLine(a + " is Greaterthan " + b + " answer is " + isGreater); -
concatination
string name = Console.ReadLine(); - getting user input
int num2 = int.Parse(Console.ReadLine()); - get user input integer(number)
double num2 = double.Parse(Console.ReadLine()); - get user input (decimal)
bool isTrue = bool.Parse(Console.ReadLine()); - get user input (true/false)

==data types==
string sample; - declare string
int num1; - declare whole number
double num1; - with decimal
bool isTrue; - declare true/false
name[0] - get specific character in string
name.Length - length of string

===OPERATIONAL===
num1 +/*- num2 - calcu
num1 % num2 - remainder

==logical==
&& - and
|| - or

==Comparison==

a > bv - greater than


a < b - less than
a >= b - greater than or equal
a <= b - less than or equal
a == b - equal
a != b - not equal

==if else==
if (username != user && password == pass)
{
run this;
}
else if (condition)
{
run this;
}
else
{
run this;
}

==for loop==
for(int i = 0; i < 5; i++)
{
run this
}

You might also like