Program No : 18 :

Write a program in C to find the average of 1 to 100 ?

       program no  :18
 purpose : Average of the numbers betwwen 1 to 100

#include <"stdio.h">
#include <"conio.h">

void main()

{

int loop;

float sum=0,average;

for(loop=0;loop<=100;loop++)
sum+=loop;

average=sum/100;

printf("Average of first 100 numbers  :  %f  ",average);

getch();

}  


Back