Math, asked by chimu363, 1 year ago

WAP that accepts the marks of 5 subjects and finds the sum and percentage marks obtained by the student.

Answers

Answered by misa3
4
hope this helps...............
Attachments:
Answered by MotiSani
0

C program to perform the given task is as follows:-

int main() {

   float m1, m2, m3, m4, m5;

   scanf("%f", &m1);

   scanf("%f", &m2);

   scanf("%f", &m3);

   scanf("%f", &m4);

   scanf("%f", &m5);

   float sum;

   sum = m1 + m2 + m3 + m4 + m5;

   float percent;

   percent = ((m1 + m2 + m3 + m4 + m5)/500) *100;

   

   printf("Sum= %f\n", sum);

   printf("Percentage= %f\n", percent);

   return 0;

}

  • In the main function, firstly we are declaring 5 variables: m1, m2, m3, m4 and m5 with the data type of float.
  • Next, we are taking input from the user using scanf function.
  • Next, we are calculating the sum and percentage of marks obtained by the user.
  • Finally, we are printing the sum and the percentage.

#SPJ3

Similar questions