Assume the int variables i , lo , hi , and result have been declared and that lo and hi have been initialized.

LANGUAGE: C++

CHALLENGE:

Assume the int variables i , lo , hi , and result have been declared and that lo and hi have been initialized.

Write a for loop that adds the integers between lo and hi (inclusive), and stores the result in result .
Your code should not change the values of lo and hi . Also, do not declare any additional variables — use only i , lo , hi , and result.

SOLUTION:

The Bad News: The content you are trying to access is only available to members.

The Good News: You too can be a member, simply Click Here.

Already a member?

Posted in ,

1 Comment

  1. J Cohenour on February 28, 2017 at 5:04 pm

    Java (same as c++ but some of you may not know that)

Leave a Comment

You must be logged in to post a comment.