write a program structure to find average of given number



write a program structure to find average of given number..

Answer / 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

More C Interview Questions

How are variables declared in c?

0 Answers  


Explain the advantages and disadvantages of macros.

0 Answers   TCS,


Write a c program to find, no of occurance of a given word in a file. The word is case sensitive.

2 Answers  


Write a program to enter the name and age. If age>28 then find salary categories. if age<28 then find that you are gaduate or not.

1 Answers  


why division operator not work in case of float constant?

2 Answers  


what is data structure?

5 Answers   CBSE,


How many bytes are occupied by near, far and huge pointers (dos)?

0 Answers  


Is c an object oriented programming language?

1 Answers  


Explain two-dimensional array.

0 Answers  


Why is struct padding needed?

0 Answers  


Example of friendly function in c++

2 Answers  


1)which of following operator can't be overloaded. a)== b)++ c)?! d)<=

16 Answers   CybOrg, Siemens,


Categories