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 / asish manoj k

#include <conio.h>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
int n,r=0,i,a[10],s=0;

printf("enter the size of the array");
scanf("%d",&n);

for(i=0;i<n;i++)
{
printf("enter the %d element",r);
scanf("%d",&a[i]);
r=r+1;

}
for(i=0;i<n;i++)
{

s=s+a[i];
}

printf("sum of the elements of the array is %d",s);
system("PAUSE");
return EXIT_SUCCESS;
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate abs() function from fabs() function.

1007


Are pointers really faster than arrays?

1020


Can a pointer be volatile in c?

981


what is the different bitween abap and abap-hr?

2314


Can a variable be both const and volatile?

1128


What is a program flowchart?

1191


Can we declare function inside main?

997


What is the easiest sorting method to use?

1158


Is c is a low level language?

1128


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

1097


Find duplicates in a file containing 6 digit number (like uid) in O (n) time.

3241


Which is best linux os?

1024


write a program to concatenation the string using switch case?

2093


Why does the call char scanf work?

1201


Where is c used?

1092