bool isRaining = true;
bool isSunny = false
using System;
class Program
{
static void Main()
{
bool isRaining = true;
bool isSunny = false;
bool haveUmbrella = true;
// Check weather conditions
if (isRaining && haveUmbrella)
{
Console.WriteLine("It's raining, but I have an umbrella.");
}
else if (isRaining && !haveUmbrella)
{
Console.WriteLine("It's raining, and I don't have an umbrella. Stay inside!");
}
else if (isSunny)
{
Console.WriteLine("It's sunny outside. Enjoy the weather!");
}
else
{
Console.WriteLine("Weather conditions are unclear. Be prepared for anything.");
}
// Example of using logical OR
bool isWeekend = true;
bool isHoliday = false;
if (isWeekend || isHoliday)
{
Console.WriteLine("It's a day off! Relax and have fun.");
}
else
{
Console.WriteLine("It's a working day. Time to get things done.");
}
// Example of using logical NOT
if (!isSunny)
{
Console.WriteLine("It's not sunny today. Maybe tomorrow!");
}
}
}