How can i add the values of the variable from the array

+1 Alexis Ahmed · February 3, 2016
How can i add them, for example if x has 2 values and i declare 1 and 2 to x , then how can i add them and get the sum

Post a Reply

Replies

Oldest  Newest  Rating
0 Laura Lee · February 6, 2016
int X[2] = {1,2};
int Sum = 0;
for(int I = 0; I < sizeof(X); ++I)
Sum+=X[I];
0 Pere Garau Burguera · February 3, 2016
sum = x[0] + x[1]; 
  • 1

C++

107,289 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator