C# Programs
using System;
class Program1
{
static void Main()
{
// Program 1: Find the Sum of Three Greatest Numbers
[Link]("Enter first number: ");
int num1 = Convert.ToInt32([Link]());
[Link]("Enter second number: ");
int num2 = Convert.ToInt32([Link]());
[Link]("Enter third number: ");
int num3 = Convert.ToInt32([Link]());
int greatestSum = num1 + num2 + num3;
[Link]("Sum of the three numbers: " + greatestSum + "\n");
}
}
using System;
class Program2
{
static void Main()
{
// Program 2: Check if a Number is Even or Odd
[Link]("Enter a number to check even or odd: ");
int number = Convert.ToInt32([Link]());
if (number % 2 == 0)
{
[Link]("The number " + number + " is Even.\n");
}
else
{
[Link]("The number " + number + " is Odd.\n");
}
}
}
using System;
class Program3
{
static void Main()
{
// Program 3: Simple For Loop Example
[Link]("Counting from 1 to 10:");
for (int i = 1; i <= 10; i++)
{
[Link](i);
}
[Link]();
}
}
using System;
class Program4
{
static void Main()
{
// Program 4: Print the Days of the Week
string[] days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
[Link]("Days of the Week:");
foreach (string day in days)
{
[Link](day);
}
}
}