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
What does typeof return in c?
What is the use of header?
Which is an example of a structural homology?
What are the standard predefined macros?
Which is better between malloc and calloc?
What is difference between array and pointer in c?
How to declare pointer variables?
How can I manipulate strings of multibyte characters?
How can I recover the file name given an open stream or file descriptor?
Where are the auto variables stored?
What is wrong with this statement? Myname = 'robin';
Can we access array using pointer in c language?
write a program to generate address labels using structures?
What is extern variable in c with example?
What is LINKED LIST? How can you access the last element in a linked list?