1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Leni [432]
3 years ago
7

write c++programs for the following problem: Let the user enter two numbers and display which is greater. please help!

Computers and Technology
1 answer:
zmey [24]3 years ago
3 0

Program to display greater number:


#include <iostream>                     <em>// Needed to perform IO operations    </em>

#include<conio.h>                     <em>  // header file</em>

using namespace std;  


int main()                                        //start of the program

{

   int a , b =0;                         //initialising the two integer variable

   cout<< "Enter first number"<<endl;  

    cin >> a;                                     //user's first number

    cout<< "Enter second number"<<endl;

    cin >> b;                                    //user's second number

     if (a>b)                       //comparing the two integers input by user

  cout<<  a << "is greater than" << b;    //display the greater number

    else

  cout<<  b << "is greater than" << a;                

return 0;                                                               // exist

}


     

You might be interested in
2 ways to assign a value to a variable
Art [367]
Assigning values at run time
Assigning values as command line argument, before execution of the program

4 0
3 years ago
An effective problem statement ensures that
swat32
The software design effectively addresses the issues
6 0
3 years ago
Which statement compares the copy and cut commands?
ella [17]

Answer: duplicate

Explanation:

5 0
2 years ago
Read 2 more answers
Write an expression that will cause "greater or equal to -10" to print if the value of userNum is greater than or equal to -10.
Lilit [14]

Answer:

Expression for the above problem in python language:

userNum=int(input("Enter the value of user_Num")) #it is used to take input.

if(userNum>(-10)): #if statement

   print("The value of the userNum is greator")

elif(userNum==(-10)): #elif statement

   print("The value of the userNum is equal to -10")

else: #else statement.

   print("The value of the userNum is small")

Output:

  • If the user input is (-10), it will print equal.
  • If the user input 10, it will print greator message.

Explanation:

  • The above program or expression is in python language, where the first line is used to render a message to the user take the input and store it into a userNUM variable.
  • Then the second line is used to check the user num value to be greater with the help of if statement.
  • Then the third statement is used to check the user num value to be equal with the help of elif statement.
  • Then the else statement will execute when the if and the elif statement will not true.
6 0
3 years ago
When activated, an Excel object has all the features of an Excel
Rainbow [258]
D. Workbook
Hope this helps
7 0
3 years ago
Read 2 more answers
Other questions:
  • An email can lead to miscommunication because:
    6·2 answers
  • Write a code that makes a 2D square array with 20×20 elements. Fill the array with random numbers initially. Then, "draw" a squa
    9·1 answer
  • Which of the following best describes a toolbar?
    7·1 answer
  • Write a program which capitalize every character after full stopin a given sentence
    11·1 answer
  • Which type of disk uses primary partitions, extended partitions, and logical drives to organize data?
    9·1 answer
  • Which disc store compacity for full lenght movie? dvd or cd
    14·1 answer
  • Which of the following is not a key way that a LAN shares
    15·1 answer
  • Which of the following are valid calls to Math.max? 1. Math.max(1,4) 2. Math.max(2.3, 5) 3. Math.max(1, 3, 5, 7) 4. Math.max(-1.
    9·1 answer
  • Write a Python program that inputs an integer between 0 and 1000 and adds all the digits in the integer. For example, if integer
    6·1 answer
  • Computer programming 3
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!