using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace InputFiveNumberSumAvg
{
class Program
{
static void Main(string[] args)
{
int nNum1, nNum2, nNum3, nNum4, nNum5;
int nSum, nAvg;
Console.WriteLine("Enter the Number");
Console.Write("nNum1:");
nNum1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the Number");
Console.Write("nNum2:");
nNum2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the Number");
Console.Write("nNum3:");
nNum3 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the Number");
Console.Write("nNum4:");
nNum4 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the Number");
Console.Write("nNum5:");
nNum5 = Convert.ToInt32(Console.ReadLine());
nSum = nNum1 + nNum2+ nNum3 + nNum4 + nNum5 ;
Console.ForegroundColor=ConsoleColor.Yellow;
Console.Write("Display the sum is: "+nSum);
nAvg = nSum / 5;
Console.Write("\nDisplay the avg is: "+nAvg);
Console.ReadLine();
}
}
}
No comments:
Post a Comment