**#include<stdio.h>**

**#include<conio.h>**

**void main()**

**{**

**int a[20],n,i,t=0;**

**float avg=0;**

**clrscr();**

**printf("\nEnter the n numbers: ");**

**scanf("%d",&n);**

**printf("\nEnter the numbers: ");**

**for(i=0;i<n;i++)**

**{**

**scanf("%d",&a[i]);**

**t=t+a[i];**

**}**

**printf("\nTotal is:%d",t);**

**avg=(float)t/n;**

**printf("\nAverage of n numbers is: %f",avg);**

**getch();**

**}**

**//OUTPUT:**

**//Enter the n numbers: 10**

**//Enter the numbers: 1**

**//2**

**//3**

**//4**

**//5**

**//6**

**//7**

**//8**

**//9**

**//10**

**//Total is: 55**

**//Average of n numbers is: 5.5**

## No comments:

## Post a Comment