Ask Question
3 March, 03:50

Write a C+ + program that allows the user to enter double values. Display one of two messages: "The first number you entered is larger", "The second number you entered is larger". Save file as LargerorNot. cpp

+4
Answers (1)
  1. 3 March, 06:42
    0
    Following are the program in c++

    #include / / header file

    using namespace std; / / namespace

    int main () / / main function

    {

    double a, b; / / variable declaration

    cout<<"Enter the first number and second number : / n";

    cin>>a>>b; / / input the number

    if (a>b) / / check first number greater than second number

    {

    cout<<"The first number you entered is larger";

    }

    else

    {

    cout<<"The second number you entered is larger";

    }

    return 0;

    }

    Output:

    Enter the first number and second number:

    45.5

    687.8

    The second number you entered is larger

    Explanation:

    In this program we have declared two variable i. e a and b of double type. After that check the condition if (a>b) if this condition is true then display the message "The first number you entered is larger " otherwise display the message "The second number you entered is larger".
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a C+ + program that allows the user to enter double values. Display one of two messages: "The first number you entered is larger", ...” in 📙 Computers & Technology 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