Monday, February 17, 2020

How to Find the Average of the marks of a student in C language

#include <stdio.h>
#include <stdlib.h>

  main()
  {  int m1,m2,m3,m4,m5,sum;
        float avg;
        printf("Enter Subject 1 Marks : ");
        scanf("%d",&m1);
        printf("Enter Subject 2 Marks : ");
        scanf("%d",&m2);
        printf("Enter Subject 3 Marks : ");
        scanf("%d",&m3);
        printf("Enter Subject 4 Marks : ");
        scanf("%d",&m4);
        printf("Enter Subject 5 Marks : ");
        scanf("%d",&m5);
        sum = m1+m2+m3+m4+m5;
        avg = sum/5;
        printf("THE AVERAGE IS  %f",avg);
       }

output:
Enter Subject 1 Marks : 95
Enter Subject 2 Marks : 98
Enter Subject 3 Marks : 93
Enter Subject 4 Marks : 96
Enter Subject 5 Marks : 92
THE AVERAGE IS  94.000000

No comments:

Post a Comment

python class topic video