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


Please Help Members By Posting Answers For Below Questions

Differentiate between #include<...> and #include '...'

811


Can two or more operators such as and be combined in a single line of program code?

1107


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 .

2153


Between macros and functions,which is better to use and why?

1801


Write a program to implement queue.

866


Can stdout be forced to print somewhere other than the screen?

839


a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above

979


What does a function declared as pascal do differently?

799


What is ponter?

1018


What is array of pointers to string?

788


What is structure and union in c?

810


What is the use of pragma in embedded c?

780


What is difference between class and structure?

824


What is a program flowchart and explain how does it help in writing a program?

965


How macro execution is faster than function ?

872