Ask Question
17 August, 16:34

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

+1
Answers (1)
  1. 17 August, 18:48
    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?
Find 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 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