0% found this document useful (0 votes)
5 views

Code in C

code

Uploaded by

kayani479479
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Code in C

code

Uploaded by

kayani479479
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include<stdio.

h>
#include<conio.h>
#include<stdlib.h>
int main()
{
int cout=1;
int classavg=0,fail=0,pass=0;
int agrade=0,bgrade=0,cgrade=0;
int dgrade=0,egrade=0,fgrade=0;
while(cout<=50)
{system("cls");
int num1;
printf("Enter the marks for subject of student %d: ",cout);
scanf("%d",&num1);

classavg=classavg+num1;
if(num1<50)
{
printf("You have failed.\n");
printf("Your grade is F\n");
fail++;
fgrade++;
}
else
{ printf("You have passed.\n");
pass++;
if(num1<60)
{
egrade++;
printf("Your grade is E\n");
}
else if(num1<70)
{
dgrade++;
printf("Your grade is D\n");
}
else if(num1<80)
{
cgrade++;
printf("Your grade is C\n");
}
else if(num1<90)
{
bgrade++;
printf("Your grade is B\n");
}
else
{
agrade++;
printf("Your grade is A\n");
}
}
cout++;

getch();
}
pass=pass*2;
fail=fail*2;
classavg=classavg/cout;
printf("The average marks of class is %d",classavg);
printf("The pass percentage of class is %d\n",pass);
printf("The fail percentage of class is %d\n",fail);
printf("The %d students of class got grade A\n",agrade);
printf("The %d students of class got grade B\n",bgrade);
printf("The %d students of class got grade C\n",cgrade);
printf("The %d students of class got grade D\n",dgrade);
printf("The %d students of class got grade E\n",egrade);
printf("The %d students of class got grade F\n",fgrade);

return 0;
}

You might also like