write a program to find the sum of the array elements in c
language?
Answer Posted / anuja kulkarni
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5];
int 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);
} // end of main()
| Is This Answer Correct ? | 295 Yes | 71 No |
Post New Answer View All Answers
How to write c functions that modify head pointer of a linked list?
What does sizeof function do?
Who is the main contributor in designing the c language after dennis ritchie?
Which is better oop or procedural?
Why array is used in c?
Is r written in c?
Why clrscr is used after variable declaration?
How do you declare a variable that will hold string values?
C language questions for civil engineering
Why we not create function inside function.
What is the difference between pure virtual function and virtual function?
There seem to be a few missing operators ..
What do you mean by Recursion Function?
Write programs for String Reversal & Palindrome check
List the different types of c tokens?