AnkitWebLogic

Q8. WAP to Input 5 subject marks of a student and find total marks and percentage obtained by the student. 1

#include<stdio.h>
int main()
{
    int eng, hindi, maths, sci, computer, total;
    float per;
    printf("Enter English marks:");
    scanf("%d",&eng);
    printf("Enter Hindi marks:");
    scanf("%d",&hindi);
    printf("Enter Maths marks:");
    scanf("%d",&maths);
    printf("Enter Science marks:");
    scanf("%d",&sci);
    printf("Enter Computer marks:");
    scanf("%d",&computer);

    total = eng + hindi + maths + sci + computer;
    per=total/5.0;

    printf("Total = %d",total);
    printf("\nPercentage = %f",per);
    return 0;
}
Enter English marks:50
Enter Hindi marks:60
Enter Maths marks:70
Enter Science marks:80
Enter Computer marks:91
Total = 351
Percentage = 70.20

Advertisement