#include<stdio.h>
#include<conio.h>
#include<math.h>
void main(){
float sum=0,avg=0,n;
int i=0;
char ch='y';
while (ch=='y' || ch=='Y'){
clrscr();
printf("Enter a number\n");
scanf("%f",&n);
sum=sum+n;
i++;
printf("Do you want to add another number\n press Y if not press N\n");
fflush(stdin);
scanf("%c",&ch);
}
avg=sum/i;
printf("sum = %f\n and average = %f\n Total numbers are = %d",sum,avg,i);
getch();
}
Ur programs r very helpful
ReplyDelete