Marks given(5 subjects) : find percentage and aggregate

language:  this is a C program
software used : code blocks
short name : Marks given(5 subjects) : find percentage and aggregate

topic:
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.


solution :


#include<stdio.h>
int main() {
    int p,c,m,e,h,agr,percent;
    printf("enter your marks\n");

    printf("physics=");
    scanf("%d",&p);

    printf("chemistry=");
    scanf("%d",&c);

    printf("math=");
    scanf("%d",&m);

    printf("english=");
    scanf("%d",&e);

    printf("hindi=");
    scanf("%d",&h);

    // to calculate percentage and aggregate

     agr=p+c+m+e+h;
     printf("aggregate=%d\n",agr);

    percent=agr*0.2;
    printf("percentage=%d\n",percent);

    return 0;
}


  the output :


 





N:B -   you can also use #include<conio.h>, clrscr( ); and getch( ); if you use 'turbo c'  or some old software.As i used codeblocks it was not needed.


Comments

Popular posts from this blog

library fine - c program

km in meters,feet,inches and centimeters - C program