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
What does “human-like” mean when we are talking about a machine?
pav-90 [236]
When talking about a machine and describing it as “human-like” it is suggesting that it had human like characteristics for the inanimate object.
8 0
3 years ago
Plzz help me with this question.........
Zepler [3.9K]

Answer:

please mark as brainliest!!

Explanation:

public class SumOfDigits{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Please enter a number to calculate sum of digits"); int number = sc.nextInt(); // Remember number/10 reduces one digit from number // and number%10 gives you last digit int sum = 0; int input = number; while (input != 0) { int lastdigit = input % 10; sum += lastdigit; input /= 10; } System.out.printf("Sum of digits of number %d is %d", number, sum); // closing Scanner to prevent resource leak sc.close(); } }

3 0
3 years ago
What is a feature of readable code?
mamaluj [8]

Answer:

sorry for the wait but the answer is b

Explanation:

5 0
3 years ago
Read 2 more answers
Jason is working on a Microsoft Excel worksheet and he wants to create a Print Preview shortcut. His teacher asks him to access
EastWind [94]

Answer:

New Tab (Custom) and New Group (Custom)

Explanation:

In order to accomplish this Jason needs to use New Tab (Custom) and New Group (Custom). The New Tab (Custom) will allow Jason to add a new tab with the Print Preview shortcut as a brand new tab in the software. Then using the New Group (Custom) tab, Jason can group the Print Preview shortcut with the worksheet toolbar so that it appears as part of the original toolbar with the rest of the tools available in the toolbar.

5 0
3 years ago
What is the cpu used for
Dahasolnce [82]

Answer:

A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, and input/output (I/O) operations specified by the instructions in the program.

4 0
3 years ago
Other questions:
  • A collection of facts can be copyrighted, but only if the collection is ____ in a way that causes the resulting work to rise to
    14·1 answer
  • Write a regular expression that selects lines containing any of the following words: linux windows solaris macos. For this exerc
    13·1 answer
  • The variable planet_distances is associated with a dictionary that maps planet names to planetary distances from the sun. Write
    12·1 answer
  • • Open your Netbeans IDE and answer the following question
    5·1 answer
  • Use of multimedia in business sector...​?
    5·1 answer
  • Explain to Alana why she might not want to blast her boss on social media just yet.<br>​
    6·1 answer
  • WAP to find area of circle​
    12·1 answer
  • SO I LIKE BOILED EGGS AND MY MUM WAS MAKING SALAD FOR DINNER SO I SAID DID YOU MAKE AND EGG-TRA ONE FOR ME
    13·1 answer
  • Genres are useful for many reaseons. What are some explanations you can think of for how genres can be useful to players, game d
    5·1 answer
  • Which statement is true about the energy of electromagnetic radiation?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!