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

Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

0 Answers  


How to create struct variables?

0 Answers  


If we give two names then this displays the connection between the two people. It is nothing but flames game

1 Answers  


Explain about the constants which help in debugging?

0 Answers  


Write a c program to print the sizes and ranges of different data types in c?

1 Answers  






Magic square

0 Answers  


print the pattern 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 if n=5

3 Answers   Winit,


Is both getch() and getchar() functions are similar? if it is similar means why these two functions are used for same usage? if it is not similar means what is the difference?

1 Answers   Infosys,


program to find out date after adding 31 days to a date in the month of febraury also consider the leap year

0 Answers  


Write a function that accepts two numbers,say a and b and makes bth bit of a to 0.No other bits of a should get changed.

2 Answers   Scientific Atlanta, Wipro,


What is indirection?

0 Answers  


int main() { int *p=new int; *p=10; del p; cout<<*p; *p= 60; cout<<*p; } what will be the output & why?

4 Answers   TCS,


Categories