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 are two dimensional arrays alternatively called as?
Is it possible to use curly brackets ({}) to enclose single line code in c program?
Explain how can I right-justify a string?
What is c standard library?
What are the rules for identifiers in c?
Is fortran still used today?
What will be your course of action for a push operation?
What do you mean by c what are the main characteristics of c language?
What is variable and explain rules to declare variable in c?
Tell us bitwise shift operators?
Do pointers need to be initialized?
Why can’t constant values be used to define an array’s initial size?
Why malloc is faster than calloc?
Why doesnt the call scanf work?
How is a macro different from a function?