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

Answer Posted / mathews m

#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,sum=0,x[20];
clrscr();
printf("enter the array space");
scanf("%d",&n);
printf("enter the elements");
for(i=0;i<n;i++)
scanf("%d"&x[i]);
for(i=0;i<n;i++)
{
sum=sum+x[i];
}
printf("the sum of elements in an array=%d");
}
getch();

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does typeof return in c?

640


What is the use of header?

628


Which is an example of a structural homology?

790


What are the standard predefined macros?

639


Which is better between malloc and calloc?

673






What is difference between array and pointer in c?

542


How to declare pointer variables?

689


How can I manipulate strings of multibyte characters?

643


How can I recover the file name given an open stream or file descriptor?

600


Where are the auto variables stored?

629


What is wrong with this statement? Myname = 'robin';

828


Can we access array using pointer in c language?

650


write a program to generate address labels using structures?

4012


What is extern variable in c with example?

544


What is LINKED LIST? How can you access the last element in a linked list?

636