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
timama [110]
3 years ago
7

Write a program whose inputs are three integers, and whose output is the largest of the three values. Ex: If the input is 7 15 3

, the output is: 15

Computers and Technology
1 answer:
son4ous [18]3 years ago
6 0

Answer:  

Here is the C++ program to find the largest of three integers.

#include <iostream> //to use input output functions

using namespace std; //to identify objects like cin cout

int main(){ //start of main function

int integer1, integer2, integer3;  // declare three integers

   cin>>integer1>>integer2>>integer3;  //reads values of three integers variables from user

   if (integer1 >= integer2 && integer1 >= integer3) //if value of integer1 variable is greater than or equal to both integer2 and integers3 values

       cout<<integer1;   //then largest number is integer1 and it is displayed

   else if (integer2 >= integer1 && integer2 >= integer3) //if value of integer2 variable is greater than or equal to both integer1 and integers3 values

       cout<<integer2;  //then largest number is integer2 and it is displayed

   else //in case value of integer3 variable is greater than or equal to both integer1 and integers2 values

       cout<<integer3; } //then largest number is integer3 and it is displayed

Here is the JAVA program to find the largest of three integers.

import java.util.Scanner; //to take input from user

public class Main{

public static void main(String[] args) {//start of main function

Scanner input= new Scanner(System.in); //a standard input stream.

int integer1= input.nextInt();//declare and read value of first integer

int integer2= input.nextInt();//declare and read value of second integer

int integer3= input.nextInt();//declare and read value of third integer

   if (integer1 >= integer2 && integer1 >= integer3) //if value of integer1 variable is greater than or equal to both integer2 and integers3 values

       System.out.println(integer1);   //then largest number is integer1 and it is displayed

   else if (integer2 >= integer1 && integer2 >= integer3) //if value of integer2 variable is greater than or equal to both integer1 and integers3 values

       System.out.println(integer2); //then largest number is integer2 and it is displayed

   else //when value of integer3 variable is greater than or equal to both integer1 and integers2 values

               System.out.println(integer3);  } } //then largest number is integer3 and it is displayed

Explanation:

The program is well explained in the comments attached with each statement of the program. I will explain the program with the help of an examples. Suppose

integer1 = 7

integer2 = 15

integer3 = 3

first if condition  if (integer1 >= integer2 && integer1 >= integer3) checks if value of integer1 variable is greater than or equal to both integer2 and integers3 values. Since integer1 = 7 so it is greater than integer3 = 3 but less than integer2. So this statement evaluates to false because in && ( AND logical operator) both of the conditions i.e integer1 >= integer2 and integer1 >= integer3 should be true. So the program moves to the else if part.

The else if condition else if (integer2 >= integer1 && integer2 >= integer3) checks if value of integer2 variable is greater than or equal to both integer1 and integer3 values. Since integer2 = 15 so it is greater than integer1 = 7 and also greater than integer3 = 3. So this statement evaluates to true as both parts of the else if condition holds true. So the else if part executes which has the statement: cout<<integer2; which prints the value of integer2 i.e. 15 on output screen.

Output:

15

You might be interested in
Paula needs to ensure that an animation she has created is repeated. Which option should she use to achieve this?
belka [17]

Answer:

transitions tab

Explanation:

3 0
4 years ago
Complete main() to read dates from input, one date per line. Each date's format must be as follows: March 1, 1990. Any date not
seraphim [82]

Answer:

Following is given the code as required with all necessary description as comments in it. The output is attached in last image.

Explanation:

I hope it will help you!

7 0
3 years ago
A ________ is a small, lightweight, power-conserving, computing device that is capable of wireless connectivity.
levacccp [35]

Answer:

A mobile device is a small, lightweight, power-conserving, computing device that is capable of wireless connectivity.

Explanation:

I guess say this considering a phone,watch,etc. all are small and mobile devices.

5 0
2 years ago
Questions
allsm [11]

Answer:

intrusion detection

Explanation:

The internet content filter is not going to check whether you are not welcome to any site, and that is done by intrusion detection, and hence, this is not performed by the internet content filter. However, content inspection, malware inspection, and URL filtering are performed by the internet content filter.

4 0
3 years ago
How does speech recognition software know what you are saying?
boyakko [2]
It converts the mic input into a string of raw data, then compares it to hundreds, even thousands of voice samples. The output is a polished string of data in words.
8 0
4 years ago
Other questions:
  • Each phase of the system development life cycle is accomplished as a discrete, separate step. (1 point) (Points : 1.5) True
    7·1 answer
  • Consider an SRS for a system to manage grades at a typical University:
    14·1 answer
  • In which type of land contract does the seller earn interest on the difference between what the seller owes on an existing loan
    14·1 answer
  • A malicious program that can replicate and spread from computer to computer?
    10·2 answers
  • 9. Ways in which a person or object is influenced by the surrounding environment​
    8·1 answer
  • Plz answer me will mark as brainliest ​
    8·1 answer
  • describe what measures should have been taken by the educational service and test preparation provider to avoid the security bre
    11·1 answer
  • Use the drop-down menu to correctly identify the numbering system.
    7·1 answer
  • Please help me convert the numbers into binary
    14·1 answer
  • How many pixels are in a picture that is 640 pixels wide and 480 pixels high?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!