Lambie
0
Q:

if c#

string emotions;
emotions = Console.ReadLine();
//for emotions say the user input was either
//happy,sad and mad
if (emotions == "happy")
{
  Console.Write("You are happy");
}
else if (emotions == "sad")
{
    Console.Write("You are sad");
}
else if (emotions == "mad")
{
    Console.Write("You are mad");
}
else
{
    Console.Write("Unknown input");
}
1
if (condition1)
{
  // block of code to be executed if condition1 is True
} 
else if (condition2) 
{
  // block of code to be executed if the condition1 is false and condition2 is True
} 
else
{
  // block of code to be executed if the condition1 is false and condition2 is False
}
1
int time = 22;
if (time < 10) 
{
  Console.WriteLine("Good morning.");
} 
else if (time < 20) 
{
  Console.WriteLine("Good day.");
} 
else 
{
  Console.WriteLine("Good evening.");
}
1
if (condition)
{
  print("Yes");
}
else
{
  print("No");
}
2
if((number > 10) || (number < 0))    Console.WriteLine("Hey! The number should be 0 or more and 10 or less!");else    Console.WriteLine("Good job!");
-2

New to Communities?

Join the community