You are on page 1of 3

Seatwork:

1. Write a C# Sharp program to find the largest of three


numbers.
Test Data :
Input the 1st number :25
Input the 2nd number :63
Input the 3rd number :10
Expected Output:
The 2nd Number is the greatest among three
2. Write a C# Sharp program to check whether an alphabet
letter is a vowel or a consonant.
Test Data:
k
Expected Output:
The alphabet is a consonant.
3. Write a C# Sharp program to calculate profit and loss on a
transaction.
Test Data :
500 700
Expected Output :
You can book your profit amount : 200
4. Write a C# Sharp program to read any day number as an
integer and display the name of the day as a word.
Test Data :
4
Expected Output :
Thursday
1. Answer to number 1
using System;
public class Exercise8
{
public static void Main()
{
int num1, num2, num3;
Console.Write("\n\n");
Console.Write("Find the largest of three numbers:\n");
Console.Write("------------------------------------");
Console.Write("\n\n");

Console.Write("Input the 1st number :");


num1 = Convert.ToInt32(Console.ReadLine());
Console.Write("Input the 2nd number :");
num2 = Convert.ToInt32(Console.ReadLine());
Console.Write("Input the 3rd number :");
num3 = Convert.ToInt32(Console.ReadLine());

if (num1 > num2)


{
if (num1 > num3)
{
Console.Write("The 1st Number is the greatest among three.
\n\n");
}
else
{
Console.Write("The 3rd Number is the greatest among three.
\n\n");
}
}
else if (num2 > num3)
Console.Write("The 2nd Number is the greatest among three \n\
n");
else
Console.Write("The 3rd Number is the greatest among three \n\
n");
}
}
2.

You might also like