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
cupoosta [38]
3 years ago
11

Write a program that asks the user to enter five different, integer numbers. The program then reports the largest number and the

smallest number.
Use the if statement, but no loops.
Computers and Technology
1 answer:
Akimi4 [234]3 years ago
4 0

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variables

  int minn=INT_MAX;

   int maxx=INT_MIN;

   int n1,n2,n3,n4,n5;

   cout<<"enter five Numbers:";

   //read 5 Numbers

   cin>>n1>>n2>>n3>>n4>>n5;

   // find maximum

   if(n1>maxx)

    maxx=n1;

    if(n2>maxx)

    maxx=n2;

    if(n3>maxx)

    maxx=n3;

    if(n4>maxx)

    maxx=n4;

    if(n5>maxx)

    maxx=n5;

   // find minimum

   if(n1<minn)

    minn=n1;

    if(n2<minn)

    minn=n2;

    if(n3<minn)

    minn=n3;

    if(n4<minn)

    minn=n4;

    if(n5<minn)

    minn=n5;

   // print maximum and minimum

   cout<<"maximum of five numbers is: "<<maxx<<endl;

   cout<<"minimum of five numbers is: "<<minn<<endl;

return 0;

}

Explanation:

Declare two variables "minn" & "maxx" and initialize them with INT_MAX and INT_MIN respectively.Then read the five number from user and compare it with "minn" & "maxx" ,if input is greater than "maxx" then update "maxx" or if input is less than "minn" then update the "minn". After all the inputs, "minn" will have smallest and "maxx" will have largest value.

enter five Numbers:5 78 43 55 12

maximum of five numbers is: 78

minimum of five numbers is: 5

You might be interested in
How to know your pc does not have bluetooth?
sattari [20]
Assuming you're running Windows, click the start button, and then search for "Device Manager" (or open CMD or PowerShell and type devmgmt.msc). Look at the list of devices. If Bluetooth is there, you have it; if it's not there, you don't. 
4 0
3 years ago
Explaing why the findings are different between a general purpose search engine ( google) and a meta search engine ( ask jeeves)
Softa [21]
A lot of people use google and on all search engines the sites are ordered in what people click on the most. Popularest website that fits in with the key words and different people used different websites and different search engines
6 0
3 years ago
While working on a presentation, Jack lost all the data because he switched off his computer unknowingly. On which of these comp
Lelechka [254]

Random Access memory(RAM) stores data temporary until the computer is switched off

3 0
3 years ago
Read 2 more answers
Which of the following is the BEST reason to use cash for making purchases?
PSYCHO15rus [73]

You could get a better deal.

Companies get charged when someone makes a card purchase. So if you pay in cash you could get a better deal. Like when you are buying a car, you can get a better deal because you are paying upfront and on the spot so they wont have to worry about you missing paymenyd

6 0
3 years ago
All computers can support multiple internal hard drives. <br><br> a. True <br><br> b. False
lara31 [8.8K]
False.  Some can, but some do not have space for them.  Please mark Brainliest!!!
5 0
4 years ago
Other questions:
  • Ruby is creating a presentation. She wants each slide displayed at intervals of five seconds. Which feature in the presentation
    6·2 answers
  • What is the maximum number of columns in a spreadsheet that you can sort in one instance in software like OpenOffice Calc?
    7·2 answers
  • PLZ HELP ME!!!
    13·1 answer
  • What cell phone technology is the most popular in the united states?
    8·2 answers
  • Which is a group of related software applications that are bundled and sold together?
    9·2 answers
  • How to construct a speaking library presentation database. How will you use this library and database in the furture? Based on w
    10·1 answer
  • 97 points pleaseeee helpppp
    8·2 answers
  • Quiero borrar mi cuenta como le hago ?
    6·1 answer
  • When defining a variable to be used to hold textual information containing multiple characters (letters, numbers, and/or symbols
    5·1 answer
  • I want to make a game with a friend. I use visual studio code. How do I work on the game with him? Like can he edit the same tim
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!