What is going to be the output of the following program incl

What is going to be the output of the following program: #include int main(void){struct score{int HW; int ex1; int ex2;}; float a = 0, b = 0, c = 0; struct score sc[5] = {80, 73, 56, 86, 71, 92, 76, 86, 74, 97, 50, 67, 78, 46, 87}; for(int i = 0; i

Solution

15)the output is 83.40 65.20 75.20

reason :

for every iteration of the for loop

________During first Iteartion

sc[i].HW=80

sc[i].ex1=73

sc[i].ex2=56

________During Second Iteartion

sc[i].HW=86

sc[i].ex1=71

sc[i].ex2=92

________During Third Iteartion

sc[i].HW=76

sc[i].ex1=86

sc[i].ex2=74

________During Fourth Iteartion

sc[i].HW=97

sc[i].ex1=50

sc[i].ex2=67

________During Fifth Iteartion

sc[i].HW=78

sc[i].ex1=46

sc[i].ex2=87

afterr that for the statements   

a=a+sc[i].HW;

b=b+sc[i].ex1;

c=c+sc[i].ex2;

we are adding all HW values ,ex1 values,ex2 values

later we are calculating the average and display

printf(\"%.2f\\t\",a/5);

printf(\"%.2f\\t\",b/5);

printf(\"%.2f\\t\",c/5);

___________Thank You

 What is going to be the output of the following program: #include int main(void){struct score{int HW; int ex1; int ex2;}; float a = 0, b = 0, c = 0; struct sco

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site