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 between #include<...> and #include '...'

1066


How can I implement a delay, or time a users response, with sub-second resolution?

1085


What is the difference between array and pointer in c?

1168


Explain what is the benefit of using an enum rather than a #define constant?

1227


How are pointers declared in c?

1069


What is the process to generate random numbers in c programming language?

1182


Do you know the use of fflush() function?

1067


Describe wild pointers in c?

1124


What is atoi and atof in c?

1089


What is the use of f in c?

985


Explain the use of function toupper() with and example code?

1138


What are the types of data structures in c?

1160


Why clrscr is used in c?

1019


a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

1084


Is linux written in c?

1044