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
If null and 0 are equivalent as null pointer constants, which should I use?
What is wrong with this code?
What is sizeof return in c?
Explain spaghetti programming?
What is the purpose of void in c?
Differentiate between the expression “++a” and “a++”?
What is pass by value in c?
main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above
What is the difference between int main and void main in c?
i have a written test for microland please give me test pattern
When should the const modifier be used?
Explain what is page thrashing?
What is a example of a variable?
Describe static function with its usage?
What is #define?