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

Explain about the functions strcat() and strcmp()?

598


What does printf does?

742


What is #line?

609


What is function prototype?

609


What is #define?

573






Find duplicates in a file containing 6 digit number (like uid) in O (n) time.

2608


What is a c token and types of c tokens?

587


What are the types of assignment statements?

628


Explain what is a program flowchart and explain how does it help in writing a program?

646


Why is it usually a bad idea to use gets()? Suggest a workaround.

900


What is #define in c?

620


Iam a B.Tech graduate and completed my engineering in 2009, from 2005 to 2009 and after that i had done nothing.Now i want to do job and get into BPO field . Friends give me suggestions as what to say in interview... if they ask me that what would you had done ... these many years without doing job ??????? pls urgent

1428


How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

653


What does c in a circle mean?

582


Write the syntax and purpose of a switch statement in C.

622