Source Code:
/*to find the total and percentage of an examination*/#include<stdio.h>
int main()
{
int s1, s2, s3, s4, s5, tot;
float per;
printf("Enter the marks of 5 subjects: ");
scanf("%d %d %d %d %d", &s1, &s2, &s3, &s4, &s5);
tot = s1 + s2 + s3 + s4 + s5;
per = tot / 500.0 * 100;
printf("Total = %d", tot);
printf("\nPercentage = %f", per);
return 0;
}
Sample Run:
Enter the marks of 5 subjects: 90 89 88 87 86
Total = 440
Percentage = 88.00
No comments:
Post a Comment