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

Answer Posted / m.sushma

#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],sum=0,n,i;
printf("Enter range");
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("The sum of all the elements in the given array
is\n");
for(i=0;i<n;i++)
sum=sum+a[i];
printf("%d",sum);
getch();
}

Is This Answer Correct ?    19 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is hungarian notation? Is it worthwhile?

695


What are the rules for identifiers in c?

585


How are 16- and 32-bit numbers stored?

721


What are c identifiers?

627


Explain spaghetti programming?

682






What is data structure in c programming?

572


Do you know what are bitwise shift operators in c programming?

583


What is an array in c?

593


One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.

2158


What is getch () for?

674


what is the diffrenet bettwen HTTP and internet protocol

1385


What is difference between main and void main?

624


explain what are actual arguments?

633


What is header file definition?

566


A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles

645