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

The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

0 Answers  


write a C and C++ programme to implement the A,bubble sort B,quick sort C,insertion sort D,sequential search E,binary search

1 Answers   ADP, TCS,


What are the application of c?

0 Answers  


Give me the code of in-order recursive and non-recursive.

0 Answers   DELL,


What is ambagious result in C? explain with an example.

0 Answers   Infosys,






Why do we use & in c?

0 Answers  


How are Structure passing and returning implemented by the complier?

0 Answers   TISL,


Why does everyone say not to use scanf? What should I use instead?

0 Answers  


Why header file is used in c?

0 Answers  


How can I use a preprocessorif expression to ?

0 Answers  


#include<stdio.h> #include<conio.h> # define swap(a,b) temp=a; a=b; b=temp; void main( ) { int i, j, temp; i=5; j=10; temp=0; if( i > j) swap( i, j ); printf( "%d %d %d", i, j, temp); }

9 Answers   Burning Glass,


Find greatest number out of 10 number without using loop.

5 Answers   TCS,


Categories