write a program to print student marks and percentage and average
#include<stdio.h>
#include<conio.h>
main()
{
int av,roll,a[10],n,i,s=0;
char name[12];
clrscr();
printf("enter the name of student ");
gets(name);
printf("enter the roll number of student");
scanf("%d",&roll);
printf("how many subject do u have\n ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("enter the marks in subject is %d\t",i);
scanf("%d",&a[i]);
s=s+a[i];
}
av=s/n;
clrscr();
printf("name of student is %s ",name);
for(i=1;i<=n;i++)
{
printf("marks in subject %d =%d\n",i,a[i]);
}
printf("total marks =%d \n",s);
printf("avrage marks =%d\n",av);
if(av>80)
printf("A grade");
else if (av>=70)
printf("B grade");
else if (av>=60)
printf("C grade");
else
printf("D grade ");
getch();
}
No comments:
Post a Comment