Write a program which calculate sum of several number and input it into an array. Then, the sum of all the number in the array is calculated.
Answer Posted / devi
#include<stdio.h>
#include<conio.h>
void main()
{
int a[200],i,n;
float sum=0,avg;
clrscr();
printf("Enter the n values");
scanf("%d",&n);
for(i=0;i<n;i++)
{
sum=sum+a[i];
}
avg=sum/n;
printf("Sum of %d array values is:%f",n,avg);
getch();
}
| Is This Answer Correct ? | 7 Yes | 5 No |
Post New Answer View All Answers
Explain the advantages of using macro in c language?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
What is the size of structure in c?
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
What are the scope of static variables?
What is 1d array in c?
What is a stream water?
i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....
what do you mean by enumeration constant?
Can the “if” function be used in comparing strings?
What does c value mean?
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.
What is the use of typedef in structure in c?
What is #line?