[Solved] C++ “While” Loop

[ad_1]

Here’s a tip. You’ll want to start at the users number and count down to 0. Like this:

int finalNum = 0;
int userNum;
//This is where you need to get the user's number....
while(userNum > 0)
{
    finalNum += userNum;
    userNum--;
}
//Do whatever you need to finalNum....

EDIT: It appears you’ve posted pseudocode; usually a big no-no here unless stated otherwise. It’s better to post the actual code as it’s easier to tell what exactly is going on.

1

[ad_2]

solved C++ “While” Loop