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
Are there constructors in c?
cavium networks written test pattern ..
Explain what is the general form of a c program?
Why do we use header files in c?
Tell me what is the purpose of 'register' keyword in c language?
What are the characteristics of arrays in c?
What is ponter?
write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...
Can you think of a logic behind the game minesweeper.
Tell us two differences between new () and malloc ()?
while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above
When should the volatile modifier be used?
What is the description for syntax errors?
Explain the difference between ++u and u++?
Explain what is wrong in this statement?