Write a program to take 10 numbers as input and print their average
Answers
Answer:
This Program will work in C compiler...
you can make it simple by getting numbers at one input.
Explanation:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d,e,f,g,h,i,j; /*for numbers*/
float res; /* for the average*/
/*ask the user for input*/
printf("Please Enter first Number:") ;
scanf("%d",&a);
printf("\nPlease Enter 2nd Number:") ;
scanf("%d",&b);
printf("\nPlease Enter 3rd Number:") ;
scanf("%d",&c);
printf("\nPlease Enter 4th Number:") ;
scanf("%d",&d);
printf("\nPlease Enter 5th Number:") ;
scanf("%d",&e);
printf("\nPlease Enter 6th Number:") ;
scanf("%d",&f);
printf("\nPlease Enter 7th Number:") ;
scanf("%d",&g);
printf("\nPlease Enter 8th Number:") ;
scanf("%d",&h);
printf("\nPlease Enter 9th Number:") ;
scanf("%d",&i);
printf("\nPlease Enter 10th Number:") ;
scanf("%d",&j);
res = ((a+b+c+d+e+f+g+h+i+j)/10);
printf("\nThe average of 10 given numbers is : %f",res);
getch();
}