Ask Question
27 January, 21:20

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. 27 January, 21:26
    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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers