find min, max, avg, amount uses in a week in c# program.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CP__TH__task
{
class Program
{
static void Main(string[] args)
{
int n,cnt=1,amt,sv,tamt=0,tsv=0,max=0,min=0,avg=0;
Console.WriteLine("Enter No of Days:");
n = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
Console.WriteLine("Enter Amount of day{0} ",cnt);
amt = int.Parse(Console.ReadLine());
tamt += amt;
Console.WriteLine("Enter Saving Amount Of day{0}",cnt);
sv = int.Parse(Console.ReadLine());
tsv += sv;
if (i==1)
{
max = amt;
min = amt;
}
if (max<amt)
{
max = amt;
}
if (min>amt)
{
min = amt;
}
cnt++;
}
avg = tamt / n;
tamt = tamt - tsv;
Console.WriteLine("Total Amount Uses:{0}",tamt);
Console.WriteLine("Total Saving Amount:{0}",tsv);
Console.WriteLine("Minimum Amount Uses:{0}",min);
Console.WriteLine("Maximum Amount Uses:{0}",max);
Console.WriteLine("Average Amount OF per day:{0}",avg);
}
}
}
Comments
Post a Comment