Click the Follow Button

c ; How to get percentage and aggrigate by inputting the numbers

 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 ban, eng, math, phy, chem;

    printf("enter your marks: Bang Eng Math Phy Chem\n");
    scanf("%d %d %d %d %d", &ban, &eng, &math, &phy, &chem);

    int agg = ("%d %d %d %d %d", ban + eng + math + phy + chem);
    float per = ("%f", agg/5);

    printf("Your aggrigate is %d and percentage is %f", agg, per);
}

Comments

Popular Posts

TIC - TAC - TOE

Prime and not prime number

do_while loop is to do something again and again