Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In C# Write a program that allows the user to enter two integers (use the a Conv

ID: 3837049 • Letter: I

Question

In C# Write a program that allows the user to enter two integers (use the a Convert method.) Write separate methods that produce the sum, product, average, and squared result of the values. Call the squared result on both entered values, that is, call the method twice to calculate the square value of each entered value.

Also in C#, Write an application that enables users to enter student ID and three exam scores. Provide a method to compute and return the overall exam average. Provide another method that prints all scores and the average value formatted with no digits to the right of the decimal (use a Math method to round the result.)

Explanation / Answer

using System;
using System.Collections.Generic;
using System.Text;
namespace Program
{
class Program
{
static void Main(string[] args)
{
int Num1, Num2, result;
char option;
Console.Write("Enter the First Number : ");
Num1 = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter the Second Number : ");
Num2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Main Menu");
Console.WriteLine("1. Addition");
Console.WriteLine("2. Subtraction");
Console.WriteLine("3. Multiplication");
Console.WriteLine("4. Division");
Console.Write("Enter the Operation you want to perform : ");
option = Convert.ToChar(Console.ReadLine());
switch (option)
{
case '1':
result = Num1 + Num2;
Console.WriteLine("The result of Addition is : {0}", result);
break;
case '2':
result = Num1 - Num2;
Console.WriteLine("The result of Subtraction is : {0}", result);
break;
case '3':
result = Num1 * Num2;
Console.WriteLine("The result of Multiplication is : {0}", result);
break;
case '4':
result = Num1 / Num2;
Console.WriteLine("The result of Division is : {0}", result);
break;
default:
Console.WriteLine("Invalid Option");
break;
}
Console.ReadLine();
}

}
}