Computer Science, asked by amrish17, 1 year ago

write a formula to find sum of all five subjects in computer​

Answers

Answered by rahulgrover033
6

In the program five subjects are contained to deduct average and total marks. Write a program to read the data and determine the following:

Collect the Data for each subject.

Calculate the sum of all subjects.

Using the formula for Sum of subject and Calculating the Average.

Display the result that comes as output in the end.

That is source code of the C program to find the Sum and calculate the Average and percentage of Five subjects. The control statement is used in this code for executing the condition.

void main()

{

int a,b,c,d,e;

float f,g,h;

clrscr();

printf("Enter the Marks Subject maths = ");

scanf("%d",&a);

printf("Enter the Marks Subject hindi = ");

scanf("%d",&b);

printf("Enter the Marks Subject punjabi = ");

scanf("%d",&c);

printf("Enter the Marks Subject english = ");

scanf("%d",&d);

printf("Enter the Marks Subject science = ");

scanf("%d",&e);

f=a+b+c+d+e;

g=f/5;

h=(f/500)*100;

printf("\nTotal Marks = %f ",f);

printf("\nAverage Marks = %f",g);

printf("\nPercentage Marks = %f %",h);

getch();

Similar questions