Tuesday, September 7, 2010

Avg. Of N No’s. Untill 0.

#include"stdio.h">
#include"conio.h"
void main()
{
 float avg,sum=0,count=0;
 int i,n,a;

 printf("Enter n no. values: ");
 printf("\nEnter values:");

 for(i=1;i<=i;i++)
 {
  scanf("%d",&a);
  sum=sum+a;
  if(a==0)
  {
   avg=sum/(i-1);
   printf("\nAverage of %d No's. before 0: =%.1f",i-1,avg);
  }
 }


 getch();

}

No comments: