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
How do I create a directory? How do I remove a directory (and its contents)?
What is the use of ?
What is an lvalue?
What is wild pointer in c with example?
What is a newline escape sequence?
how should functions be apportioned among source files?
What do you mean by dynamic memory allocation in c? What functions are used?
What 'lex' does?
How to explain the final year project as a fresher please answer with sample project
explain how do you use macro?
How can I find the modification date of a file?
I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.
What is variable declaration and definition in c?
What is the use of a semicolon (;) at the end of every program statement?
what are bit fields in c?