Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

get range sum

// get sum from x to y
// initialization of variables
int x = 1, y = 100, sum = 0;
// loop from x to y and add up the current index i
for(int i = x; i = y; i++) sum += i;
std::cout << sum;
 
PREVIOUS NEXT
Tagged: #range #sum
ADD COMMENT
Topic
Name
9+1 =