adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Program in C to calculate sum of 5 subjects marks and find percentage

Program in C to calculate sum of 5 subjects marks and find percentage 



//Program to calculate sum of 5 subjects marks and find percentage in C
#include<stdio.h>
 int main()
  {
    int sub1,sub2,sub3,sub4,sub5,sum;
    float per;
    printf("Enter 5 subjects marks :- ");
    scanf("%d%d%d%d%d",&sub1,&sub2,&sub3,&sub4,&sub5);
    //calculate sum of 5 subjects marks
    sum = sub1 + sub2 + sub3 + sub4 + sub5;
    //Calculate percentage
    per = sum / 5.0;
    printf("Total marks = %d",sum);
    printf("\nPercentage = %.2f\n",per);
    return 0;
  }
Output :-









Video
   

Post a Comment

0 Comments