Example 1
Rock, paper, scissors
Console.WriteLine(«Enter hand:»);
string userName = Console.ReadLine();
string userName1 = Console.ReadLine();
if(userName == «tuxt» && userName1 == «qar»){
Console.WriteLine(userName);
}else if(userName == «tuxt» && userName1 == «mkrat»){
Console.WriteLine(userName);
}else if(userName == «qar» && userName1 == «mkrat»){
Console.WriteLine(userName);
}
}
Example 2
Console.WriteLine(«Գրիր քո տարիքը և իմացիր 100 տարի հետո, որ թիվ կլինես»);
int tariq = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(2022 — tariq + 100);
Example 3
Եթե թվերի մեյ կա մեր ուզած թիվը ապա կրի (կա)
int[] num = {1, 2, 3, 4, 5, 6, 7};
// int x = Convert.ToInt32(Console.ReadLine());
// for (int i = 0; i < num.Length; i++){
// if(num[i] == x){
// Console.WriteLine(«կա»);
// }
// }
// }
// }
Example 4
using System;
namespace palindromecheck {
class Program {
static void Main(string[] args) {
string string1, rev;
string1 = «Malayalam»;
char[] ch = string1.ToCharArray();
Array.Reverse(ch);
rev = new string(ch);
bool b = string1.Equals(rev, StringComparison.OrdinalIgnoreCase);
if (b == true) {
Console.WriteLine(«» + string1 + » is a Palindrome!»);
} else {
Console.WriteLine(» » + string1 + » is not a Palindrome!»);
}
Console.Read();
}
}
}
//Ստեղծեք ֆունկցիա, որը կստուգի թե քանի հատ true կա arrayi մեջ
// let arr = [true, false, true, true];
// let patasxan = arr.filter(Boolean).length;
// console.log(patasxan);