#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int s1,s2,s3,s4,s5,sum,total=500;
float per;
printf ("Enter the value of 5 subjects\n");
scanf ("\n%d%d%d%d%d" ,&s1,&s2,&s3,&s4,&s5);
sum=s1+s2+s3+s4+s5;
printf ("Sum of the marks is :%d" ,sum);
per=(sum*100)/total;
printf ("\t\nyour persentage result is :%f" ,per);
return 0;
}
Output
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int s1,s2,s3,s4,s5,sum,total=500;
float per;
printf ("Enter the value of 5 subjects\n");
scanf ("\n%d%d%d%d%d" ,&s1,&s2,&s3,&s4,&s5);
sum=s1+s2+s3+s4+s5;
printf ("Sum of the marks is :%d" ,sum);
per=(sum*100)/total;
printf ("\t\nyour persentage result is :%f" ,per);
return 0;
}
Output
Comments
Post a Comment