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
Explain what is wrong with this program statement?
What is meant by keywords in c?
How can you be sure that a program follows the ANSI C standard?
What is function prototype?
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
Why do we use int main instead of void main in c?
How to write a code for implementing my own printf() and
scanf().... Please hep me in this... I need a guidance...
Can you give an coding for c... Please also explain about
the header files used other than #include
Why dont c comments nest?
Why main is not a keyword in c?
What is the difference between array and structure in c?
Write a program to print factorial of given number using recursion?
provide an example of the Group by clause, when would you use this clause
How to get string length of given string in c?
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)
What is the role of && operator in a program code?