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 the expression “++a” and “a++”?
Why isnt there a numbered, multi-level break statement to break out
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
Is boolean a datatype in c?
What are the similarities between c and c++?
What are the uses of a pointer?
How do you determine whether to use a stream function or a low-level function?
What are the loops in c?
What are the 5 types of inheritance in c ++?
How do you define CONSTANT in C?
Explain the difference between strcpy() and memcpy() function?
What does *p++ do? What does it point to?
Why is not a pointer null after calling free?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
How can I determine whether a machines byte order is big-endian or little-endian?