C program to calculate percentage of student accept subject marks from user
void main()
{ float ans;
int s1,s2,s3,s4,s5;
char name[20],std[5],sn1[]="C Language",sn2[]="DBMS",sn3[]="FOC",sn4[]="SE",sn5[]="PPMOB";
clrscr();
printf("\nEnter the name of student=");
gets(name);
printf("\nEnter the standard of student=");
scanf("%s",&std);
printf("\n\nEnter the marks of %s out of 30 is=",sn1);
scanf("%d",&s1);
printf("\n\nEnter the marks of %s out of 30 is=",sn2);
scanf("%d",&s2);
printf("\n\nEnter the marks of %s out of 30 is=",sn3);
scanf("%d",&s3);
printf("\n\nEnter the marks of %s out of 30 is=",sn4);
scanf("%d",&s4);
printf("\n\nEnter the marks of %s out of 30 is=",sn5);
scanf("%d",&s5);
printf("\n\n\n *********** Result ************");
ans=(s1+s2+s3+s4+s5)/1.5;
printf("\n\n The percentage of %s is =%.2f%",name,ans);
getch();
}
{ float ans;
int s1,s2,s3,s4,s5;
char name[20],std[5],sn1[]="C Language",sn2[]="DBMS",sn3[]="FOC",sn4[]="SE",sn5[]="PPMOB";
clrscr();
printf("\nEnter the name of student=");
gets(name);
printf("\nEnter the standard of student=");
scanf("%s",&std);
printf("\n\nEnter the marks of %s out of 30 is=",sn1);
scanf("%d",&s1);
printf("\n\nEnter the marks of %s out of 30 is=",sn2);
scanf("%d",&s2);
printf("\n\nEnter the marks of %s out of 30 is=",sn3);
scanf("%d",&s3);
printf("\n\nEnter the marks of %s out of 30 is=",sn4);
scanf("%d",&s4);
printf("\n\nEnter the marks of %s out of 30 is=",sn5);
scanf("%d",&s5);
printf("\n\n\n *********** Result ************");
ans=(s1+s2+s3+s4+s5)/1.5;
printf("\n\n The percentage of %s is =%.2f%",name,ans);
getch();
}