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 many key words availabel in c a) 28 b) 31 c) 32

0 Answers  


In a header file whether functions are declared or defined?

0 Answers   TISL,


How a string is stored in c?

0 Answers  


What is the output of the following program #include<stdio.h> main() { int i=0; fork(); printf("%d",i++); fork(); printf("%d",i++); fork(); wait(); }

8 Answers   ADITI, Adobe,


How can I access memory located at a certain address?

3 Answers   Verizon,






A program to write a number of letters and numbers, such as counting and display

0 Answers  


What is meant by int fun const(int a, int b) { .... ... }

1 Answers  


What is sizeof int in c?

0 Answers  


What is call by reference in functions?

1 Answers  


What kind of sorting is this? SORT (k,n) 1.[Loop on I Index] repeat thru step2 for i=1,2,........n-1 2.[For each pass,get small value] min=i; repeat for j=i+1 to N do { if K[j]<k[min] min=j; } temp=K[i];K[i]=K[min];K[min]=temp; 3.[Sorted Values will be returned] A)Bubble Sort B)Quick Sort C)Selection Sort D)Merge Sort

3 Answers   Accenture,


What are register variables? What are the advantage of using register variables?

0 Answers   TISL,


How to write c functions that modify head pointer of a linked list?

0 Answers  


Categories