Question: Assuming the existence of two integer variables named low and high that hold some values, write a few statements that declare an integer variable named

Assuming the existence of two integer variables named low and high that hold some values, write a few statements that declare an integer variable named sumRange and initialize it with the sum of all integers in the range [low, high]. In math notation, square brackets mean inclusive. You don't have to define a function or a class.
For example:
Test Result
int low =10, high =20;
165
int low =100, high =20;
0
int low =20, high =20;
20
int low =-100, high =-80;
-1890
int low =100000, high =100099;
10004950
int low =0, high =-1;
0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!