# Compute Average of Two Scores

Describe an algorithm to compute the average of two scores obtained by each of the 100 students

#### Sandhya.Kishan Profile Answers by Sandhya.Kishan

• Apr 18th, 2012

This can be done using structures

struct student
{
int score1;
int score2;
}st;

int sum,avg;
printf("Enter the first score:");
scanf{"%d",&st[i].score1);
printf("Enter the second score:");
scanf{"%d",&st[i].score2);
for(i=0;i<5;i++)
{
sum=st[i].score1+st[i].score2;
avg=sum/2;
printf("average=%d",&avg);
}

#### Shikhar Singhal

• Jun 10th, 2013

Algorithm-

Let score1 and score2 be the arrays storing respective marks of the 100 students
let float avg store the average of the respective students.

for n=0 to 99
avg[n]= (float(score1[n] +score2[n]))/ 2.0 //here 2.0 i simportant as it is used to get a floating point answer and not an integer value

#### HAkizimfura Yves

• May 27th, 2014

write an algorithm that will display the sum of 5 integers by using two variables only
NB: do not use loops!  