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


Please Help Members By Posting Answers For Below Questions

How do I create a directory? How do I remove a directory (and its contents)?

600


What is the use of ?

613


What is an lvalue?

627


What is wild pointer in c with example?

568


What is a newline escape sequence?

659






how should functions be apportioned among source files?

621


What do you mean by dynamic memory allocation in c? What functions are used?

644


What 'lex' does?

710


How to explain the final year project as a fresher please answer with sample project

463


explain how do you use macro?

663


How can I find the modification date of a file?

695


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.

1733


What is variable declaration and definition in c?

493


What is the use of a semicolon (;) at the end of every program statement?

761


what are bit fields in c?

599