Q: If the marks obtained by a student in five different subjects are input through the keyboard, write a program to find out the aggregate marks and percentage marks obtained by the student. Assume that the maximum marks that can be obtained by a student in each subject is 100.


#include<stdio.h>
int main()
{
    int computer, math, english, physics, chemistry, aggregrate;
    float percentage;
 
    printf("Enter the marks obtained in Computer: ");
    scanf("%d", &computer);

    printf("Enter the mark obtained in English: ");
    scanf("%d", &english);

    printf("Enter the marks obtained in Physics: ");
    scanf("%d", &physics);
 
    printf("Enter the marks obtained in Math: ");
    scanf("%d", &math);

    printf("Enter the marks obtained in Chemistry: ");
    scanf("%d", &chemistry);

    aggregrate = computer+math+english+physics+chemistry;

    percentage =  aggregrate/5;

    printf("\n\nAggregate marks obtained by student: %d",aggregrate);
    printf("\nPercentage marks obtained by student: %f %%",percentage);
 
        return 0;
}

-----------------------------------------
output:

Enter the marks obtained in Computer: 98
Enter the mark obtained in English: 86
Enter the marks obtained in Physics: 82
Enter the marks obtained in Math: 99
Enter the marks obtained in Chemistry: 92


Aggregate marks obtained by student: 457
Percentage marks obtained by student: 91.000000 %

Comments

Popular posts from this blog

Q: The length & breadth of a rectangle and radius of a circle are input through the keyboard. Write a program to calculate area & perimeter of the rectangle and area & circumference of the circle.

Q: If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits. (Hint: Use the modulus operator ‘%’)