# Find average of n numbers

Write a program to find average of n numbers given by user.

Logic

- Take n from user
- Take n numbers form user
- Compute average and print it

#include<stdio.h> int main(){ int n,number,sum; //Initilize sum to zero sum=0; printf("How many integers do you wish to average?n"); scanf("%d",&n); int i; for(i=1;i<=n;i++){ //Input the number scanf("%d",&number); //Add it to sum sum+=number; } double avg=(double)sum/n; //Typecast it to double //coz average can be floating point number printf("The average of %d numbers is %lf n",n,avg); // ld --(for)--> double return 0; }