write a program to find the sum of the array elements in c
language?
Answer Posted / lalit suthar, nilod
// write a program to find the sum of the array elements in
c language?
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],i,sum=0;
clrscr();
printf("Enter the array elements\n");
for (i=0; i<5; i++)
scanf("%d",&a[i]);
// sum of array elements
for (i=0; i<5; i++)
{
sum=sum+a[i];
}
printf("Sum of array elements===%d",sum);
getch();
}
Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is the difference between array and pointer?
why do some people write if(0 == x) instead of if(x == 0)?
What is static function in c?
How can you invoke another program from within a C program?
How can I swap two values without using a temporary?
How do I read the arrow keys? What about function keys?
What does 1f stand for?
What does %c do in c?
What is the argument of a function in c?
Why & is used in c?
How can you read a directory in a C program?
Why is void main used?
Tell us two differences between new () and malloc ()?
What are keywords in c with examples?
Is boolean a datatype in c?