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

Answer Posted / bishmeet singh

#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],i,sum=0;
clrscr();
printf("enter the 5 elements to sum");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<5;i++)
{
sum=sum+a[i];
}
printf("sum of the elements is %d",sum);
}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above

663


What is the usage of the pointer in c?

608


Can the sizeof operator be used to tell the size of an array passed to a function?

623


What are the different types of endless loops?

626


How can my program discover the complete pathname to the executable from which it was invoked?

665






Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

678


Tell me when would you use a pointer to a function?

613


What is the difference between variable declaration and variable definition in c?

566


How to declare a variable?

575


What is the use of typedef in c?

594


Why is c so popular?

655


What is modifier & how many types of modifiers available in c?

614


What is meant by high-order and low-order bytes?

658


What is an identifier?

632


What are the application of void data type in c?

726