write a program structure to find average of given number
Answer Posted / manjunath
#include<stdio.h>
#include<math.h>
void main()
{
int num,a[100],sum=0;
float average;
printf("enter the number of elements");
scanf("%d",&num);
printf("enter the elements");
for(i=0;i<num;i++)
{
scanf("%d",&a[i]);
}
printf("the elements are");
for(i=0;i<num;i++)
{
printf("%d",a[i]);
}
for(i=0;i<num;i++)
{
sum=sum+a[i];
}
average=sum/num;
printf("%f",average);
}
Is This Answer Correct ? | 13 Yes | 9 No |
Post New Answer View All Answers
Differentiate between #include<...> and #include '...'
Can two or more operators such as and be combined in a single line of program code?
hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .
Between macros and functions,which is better to use and why?
Write a program to implement queue.
Can stdout be forced to print somewhere other than the screen?
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
What does a function declared as pascal do differently?
What is ponter?
What is array of pointers to string?
What is structure and union in c?
What is the use of pragma in embedded c?
What is difference between class and structure?
What is a program flowchart and explain how does it help in writing a program?
How macro execution is faster than function ?