Tuesday, July 16, 2019

Find average and give a class(Distiction,First Class, second class,pass class,fail)

Find average and give a class
(Distiction,First Class, second class,pass class,Fail)

Find Average and give a class.


#include<stdio.h>
#include<conio.h>

void main()
{
int s1,s2,s3,s4,s5,total;
float avg;
clrscr();
printf("Enter The Student Marks=>");
scanf("%d%d%d%d%d",&s1,&s2,&s3,&s4,&s5);

total=s1+s2+s3+s4+s5;


avg=total/5;


if(avg<=0 || avg>=100)
{
printf("\nInvalid");
}
else if(avg>=80)
{
printf("\nAverage is %f=>",avg);
printf("\nTotal is %d=>",total);
printf("\nDistiction",avg);
}
else if(avg>=65)
{
printf("\nAverage is %f=>",avg);
printf("\nTotal is %d=>",total);
printf("\nFirstclass",avg);
}
else if(avg>=55)
{
printf("\nAverage is %f=>",avg);
printf("\nTotal is %d=>",total);
printf("\nsecondclass",avg);
}

else if(avg>=40)
{
printf("\nAverage is %f=>",avg);
printf("\nTotal is %d=>",total);
printf("\npassclass",avg);
}
else if(avg<=35)
{
printf("\nAverage is %f=>",avg);
printf("\nTotal is %d=>",total);
printf("\n fail",avg);
}
getch();
}

Output:




EmoticonEmoticon