Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Why main function is special give two reasons?

1548


general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only

1077


What are examples of structures?

1116


Difference between pass by reference and pass by value?

1164


What are qualifiers in c?

1039


Are enumerations really portable?

1030


What is structure pointer in c?

1061


Tell me what are bitwise shift operators?

1133


What is getch () for?

1243


What is a constant?

1066


Can we access array using pointer in c language?

1096


how to write optimum code to divide a 50 digit number with a 25 digit number??

3270


How can I sort more data than will fit in memory?

1115


what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above

1128


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2442