Ask Question
14 March, 20:36

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.

+1
Answers (1)
  1. 15 March, 00:04
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers