View Single Post
Old 03-13-2005, 04:08 PM   #4 (permalink)
mohsh2002
 
Newb Techie

Join Date: Jan 2005

Posts: 20

mohsh2002

Default

look what i have done

#include<stdio.h>

int main()

{
int i , j , results;
float total , avg , data;

for ( i= 1 ; i<=4 ; ++i )

{

printf("Enter the number of results for experiment #%d: ",i);
scanf("%d",&results);
printf("Enter %d for experiment #%d: ",results,i);



for (j=1,total= 0.0; j<=results;++j)

{

scanf("%f",&data);
total += data;

}

avg=total/results;

printf(" The average for experiment #%d is %.2f\n\n",i,avg);

}
system("PAUSE");
return 0;

}


but now i am the one who enters the value and i dont want that. we are not suppose to use strings or anything. YOU HAVE TO USE NESTED LOOP. thanx
mohsh2002 is offline