write a program to find the sum of the array elements in c
language?

Answer Posted / vaibhav

#include<stdio.h>
#include<conio.h>
void main()
{
int n[5],sum=0,i=0;
clrscr();
for(i=0;i<4;i++)
{
scanf("%d",&n[i]);
}

for(i=0;i<4;i++)
{
sum=sum+n[i];
}
printf("sum are%d",sum);
getch();
}

Is This Answer Correct ?    72 Yes 41 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of sprintf?

630


What does void main () mean?

745


What is hungarian notation? Is it worthwhile?

713


Dont ansi function prototypes render lint obsolete?

616


Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings

2257






Why main is used in c?

598


When the macros gets expanded?

804


How can this be legal c?

660


What is the difference between formatted&unformatted i/o functions?

626


What is assert and when would I use it?

591


How many bytes is a struct in c?

736


What is void main ()?

623


What is null in c?

604


How many levels of pointers can you have?

715


What is equivalent to ++i+++j?

653