Check Average, Minimum, Maximum Marks Of Student Class Performance in c# Using Loop and If-Else.
CODE:
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 max = 0, min = 0, avg = 0,tmk=0 ;
int n;
Console.WriteLine("Enter Number Of Student in Class");
n = int.Parse(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
Console.WriteLine("Enter Your Marks:");
int m =Convert.ToInt32(Console.ReadLine());
if (i==1)
{
max = m;
min = m;
}
if (max<m)
{
max = m;
}
if (min>m)
{
min = m;
}
tmk = tmk + m;
}
avg = tmk / n;
Console.WriteLine("Student average Marks:{0}",avg);
if (avg>=17)
{
Console.WriteLine("Excellent Performance");
}
else if (avg>=12)
{
Console.WriteLine("Good Performance");
}
else
{
Console.WriteLine("Bad Performance");
}
Console.WriteLine("Maximum Mark:{0}",max);
Console.WriteLine("Minimum Marks:{0}",min);
Console.WriteLine("Averrage Marks:{0}",avg);
}
}
}
Comments
Post a Comment