Answer to Question #297495 in C++ for swag

Question #297495

Print "userNum1 is negative." if userNum1 is less than 0. End with newline.

Assign userNum2 with 1 if userNum2 is greater than 10. Otherwise, print "userNum2 is less than or equal to 10.". End with newline.


1
Expert's answer
2022-02-13T18:40:34-0500
#include <iostream>


int main()
{
    int userNum1, userNum2;


    std::cout << "Enter userNum1 : ";
    std::cin >> userNum1;


    std::cout << "Enter userNum2 : ";
    std::cin >> userNum2;


    if (userNum1 < 0)
    {
        std::cout << "userNum1 is negative.\n";
    }
    if (userNum2 > 10)
    {
        userNum1 = 1;
    }
    else
    {
        std::cout << "userNum2 is less than or equal to 10.\n";
    }


    std::cout << "\nUserNum1 = " << userNum1;
    std::cout << "\nUserNum2 = " << userNum2;


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog