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
raketka [301]
3 years ago
13

Write c++ program to find maximum number for three variables using statement ?​

Computers and Technology
1 answer:
pantera1 [17]3 years ago
3 0

Answer:

#include<iostream>

using namespace std;

int main(){

int n1, n2, n3;

cout<<"Enter any three numbers: ";

cin>>n1>>n2>>n3;

if(n1>=n2 && n1>=n3){

cout<<n1<<" is the maximum";}

else if(n2>=n1 && n2>=n3){

cout<<n2<<" is the maximum";}

else{

cout<<n3<<" is the maximum";}

return 0;

}

Explanation:

The program is written in C++ and to write this program, I assumed the three variables are integers. You can change from integer to double or float, if you wish.

This line declares n1, n2 and n3 as integers

int n1, n2, n3;

This line prompts user for three numbers

cout<<"Enter any three numbers: ";

This line gets user input for the three numbers

cin>>n1>>n2>>n3;

This if condition checks if n1 is the maximum and prints n1 as the maximum, if true

<em>if(n1>=n2 && n1>=n3){</em>

<em>cout<<n1<<" is the maximum";}</em>

This else if condition checks if n2 is the maximum and prints n2 as the maximum, if true

<em>else if(n2>=n1 && n2>=n3){</em>

<em>cout<<n2<<" is the maximum";}</em>

If the above conditions are false, then n3 is the maximum and this condition prints n3 as the maximum

<em>else{</em>

<em>cout<<n3<<" is the maximum";}</em>

return 0;

You might be interested in
What information can be determined from a device's MAC address?​
rewona [7]

Answer:

I believe it is the NIC manufacturer and the serial number of the NIC

Explanation:

5 0
3 years ago
Susan is a network administrator and is setting up her company's network. In the process to determine an open port on a firewall
Dovator [93]

Answer:

poop head is big butt

Explanation:

soorru

4 0
2 years ago
Assume an algorithm takes 5.6 seconds to execute on a single 1.9 GHz processor. 20% of the algorithm is sequential. Assume that
SVETLANKA909090 [29]

Answer:

2.6 seconds

Explanation:

We first start by calculating the speed up

The formula is given as:

n/1+(n-1)F

We have n = 3 which is the number of processors

F = 20% = percentage of algorithm

When we put values into the formula

3/1+(3-1)0.20

= 3/1+2*0.20

= 3/1+0.4

= 3/1.4

Speed up = 2.14

From here we calculate the expected time

T/speedups

= 5.6/2.14

= 2.6

Therefore the expected time is 2.6 seconds

5 0
3 years ago
Which interface element of a presentation program will enable Ben to see the slide number, design template, and the page style o
kicyunya [14]

B menu bar is correct.

7 0
3 years ago
Read 2 more answers
Server 2016 is compatible for Powershell 5.0 State True or False.
Svetllana [295]

Answer:

True

Explanation:

Powershell is a command line administrative tool which ships with Windows. It is heavily integrated with the dotNET framework.

Powershell 5.0 is compatible with Windows 2016 however by default Windows 2016 comes with next higher version , namely 5.1 .

Powershell 5.0 is also compatible with Windows Server 2019, Windows Server 2012, Windows Server 2008 R2 SP1 , Windows 10, Windows 8.1 and Windows 7.

8 0
3 years ago
Other questions:
  • Which of the following statements is true of ASCII code?
    12·1 answer
  • Which is slower RAM or the CPU?
    11·2 answers
  • Answer the question ASAP please
    15·2 answers
  • What is targets net worth in 2020 (i will see if you put in 2019)
    11·1 answer
  • Select the correct word to complete the sentence
    11·2 answers
  • Write a function named enterNewPassword. This function takes no parameters. It prompts the user to enter a password until the en
    6·1 answer
  • What symbol indicates that material has been copyrighted?
    8·2 answers
  • Who has pad let and wants to talk
    15·2 answers
  • Where would you go to access frequently used icons?
    12·2 answers
  • jelaskan tiga kemungkinan sebab pengasah pensil itu tidak dapat berfungsi secara tiba-tiba (translate: explain three possible re
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!