(c) If the marks obtained by a student in five different subjects are input through the keyboard, 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.

Let Us C by Yashwant Kanetkar

 
Solution By Muhammad Kaleem UIlah



                                                                  Exercise Questions 
[H] Write C programs for the following:
(c) If the marks obtained by a student in five different subjects are input through the keyboard, 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>

#include <stdlib.h>

int main()

{

    int pf,dld,ps,dm,la,aggregate;

    printf("\n\t\t Do You Want to Calculate Your Aggregate ?");    printf("\n\t\t************************************************");

    printf("\n\t\t Enter Programming Fundamental Marks = ");

    scanf("%d",&pf);

    printf("\n\t\t Enter Digital Logic Design Marks = ");

    scanf("%d",&dld);

    printf("\n\t\t Enter Pakistan Studies Marks = ");

    scanf("%d",&ps);

    printf("\n\t\t Enter Discrete Mathematics = ");

    scanf("%d",&dm);

    printf("\n\t\t Enter Linear Algebra Marks = ");

    scanf("%d",&la);

    aggregate = (pf+dld+ps+dm+la)*100/500;

    printf("\n\t\tYour Aggregate = %d",aggregate);

    return 0;

}

Comments

Popular posts from this blog

(e) The length & breadth of a rectangle and radius of a circle are input through the keyboard. Write a program to calculate the area & perimeter of the rectangle, and the area & circumference of the circle.

(b) The distance between two cities (in km.) is input through the keyboard. Write a program to convert and print this distance in meters, feet, inches and centimeters.

(g) 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 ‘%’)