Ask Question
5 September, 17:03

Declare a variable named pump number as an integer type. Test if it is within the following range: Greater and equal to 1 and smaller and equal to 10, if it is, multiple its value by 13. Now test if it is an even number, if it is, deliver a message to the user, "it is a bad number!". If the pump number is not in the range described above, then deliver a message to user, "out of range value!"

+3
Answers (1)
  1. 5 September, 20:42
    0
    Following are the program in C+ + Language.

    #include / / header file

    using namespace std; / / namespace

    int main () / / main function

    {

    int pump; / / variable declaration

    cout<<"Enter the number: ";

    cin>>pump; / / Read the value by the user

    if ((pump > = 1) && (pump < = 10)) / / checking condition

    pump=pump * 13;

    if (pump % 2 = = 0) / / checking condition

    cout<<" it is a bad number!";

    else

    cout<<" out of range value!";

    return (0);

    }

    Output:

    Enter the number:4

    it is a bad number!

    Explanation:

    Following are the Description of the following statements.

    Declared a variable "pump" vaiable of int type. Read the number by the user by using cin function. Check the condition if ((pump > = 1) && (pump < = 10)) then it executed the if statements block. Inside this if there is also one another i. e nested if if (pump % 2 = = 0) if this statement then it executed the statement inside if otherwise else block will be executed
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Declare a variable named pump number as an integer type. Test if it is within the following range: Greater and equal to 1 and smaller and ...” in 📘 Computers and Technology 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