C program to find the average of a list of numbers entered through the keyboard

C program to find the average of a list of numbers entered through the keyboard

Program

#include<stdio.h>
#include<conio.h>

void main()
{
int i,n,sum=0,e;
float avg;
clrscr(); //to clear the screen

  printf(“How many elements:”);
scanf(“%d”,&n);
printf(“Enter all the elements one by one:”);
for(i=0;i<n;++i)
{
scanf(“%d”,&e);
sum+=e;
}
avg=sum/n;
printf(“nAverage=%f”,avg);
getch(); //to stop the screen
}

Output

DURGESH

I Love python, so I like machine learning a Lot and on the other hand, I like building apps and fun games I post blogs on my website for Tech enthusiast to learn and Share Information With The World.

Leave a Reply

Your email address will not be published. Required fields are marked *

seventeen − sixteen =

Recent Content