//The Program By Tittu Varghese
// To display the sum and average of set of given numbers.
#include<stdio.h>
#include<math.h>
#include<conio.h>
void main()
{
int x,i=1,s=0,n;
float a;
clrscr();
printf("Enter the limit\n");
scanf("%d",&n);
printf("Enter %d numbers\n",n);
while(i<=n)
{
scanf("%d",&x);
s = s+x;
i=i++;
}
printf("sum of given %d given number is %d and\n",n,s);
a =s/n;
printf("The average is %f\n",a);
getch();
}
//getch(); is used for hold the out put screen.
//clrscr(); is used for clear the screen.
//***it must use after variable declaration.
Comments
Post a Comment