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
What is the difference between constant pointer and constant variable?
What is a structural principle?
Describe the order of precedence with regards to operators in C.
What is a structure member in c?
What does a pointer variable always consist of?
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
How can I make it pause before closing the program output window?
What is #define used for in c?
Is it possible to have a function as a parameter in another function?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
What does s c mean in text?
What is null pointer constant?
What are structure members?
What is enumerated data type in c?
What is far pointer in c?