Ask Question
29 January, 04:02

Print "userNum1 is negative." if userNum1 is less than 0. End with newline. Assign userNum2 with 2 if userNum2 is greater than 10. Otherwise, print "userNum2 is less or equal 10.". End with newline.

+4
Answers (1)
  1. 29 January, 05:32
    0
    From the question, we have two variables

    1. userNum1

    2. userNum2

    And we are to print "userNum1 is negative" if userNum1 is less than 0.

    Then Assign userNum2 with 2 if userNum2 is greater than 10.

    Otherwise, print "userNum2 is less or equal 10.".

    / / Program is written in C+ + Programming Language

    / / Comments are used for explanatory purpose

    / / Program starts here

    #include

    using namespace std;

    int main ()

    {

    / / Declare variables

    int userNum1, userNum2;

    / / Accept input for these variables

    cin>>userNum1, userNum2;

    / / Condition 1

    if (userNum1 < 0)

    {

    cout<<"userNum1 is negative"<<'/n';

    }

    / / Condition 2

    if (userNum2 > 10)

    {

    userNum2 = 2;

    }

    / / If condition is less than 10

    else

    {

    cout<<"userNum2 is less or equal to 10"<
    }

    return 0;

    }

    / / End of Program.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Print "userNum1 is negative." if userNum1 is less than 0. End with newline. Assign userNum2 with 2 if userNum2 is greater than 10. ...” in 📘 Engineering if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers