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 file system allows you to continue to add files to a CD or DVD disc after the initial burn, as long as there is room on the
Sonbull [250]

Answer:

Live file system

Explanation:

The live file system allows you to continue adding files to CD or DVD disc after an initial burn as long as there is enough space left on the disc.

In an attempt to burn files on a CD or DVD disc, Windows will prompt you if you want the live file system or the other (which is mastered disc format). Once you select the live file system, you can then keep adding files over and over until there is not enough space on the disc.

Note that Windows might not display the prompt as "live file system". It could be represented in some other ways like: "Like a USB flash drive". But then going through the prompt will tell you which is which.

3 0
3 years ago
Many people blame online shopping for the demise of the high street. Discuss why high street shops find it difficult to compete
choli [55]
Because online is <em>easyer</em> and they ship it so all you have to do is sit and <u>play video games</u> and <u></u>spend money
6 0
4 years ago
Identify two related tables in the JustLee Books database. Identify the common field between the two tables. Decide which column
Hatshy [7]

Answer:

Answers explained below

Explanation:

<u>The two related table are: </u>

i) Books Table

ii) BOOKAUTHOR Table

<u>The common field between the two tables are: </u>

i) ISBN attribute

<u>The columns that i would like to display are: </u>

Title, ISBN, AuthorID, PubID, PubDate, Cost, Retail, Discount, Category

<u>Sql Code to join tables using where clause </u>

select t1.Title, t1.ISBN, t2.AuthorID, t1.PubID, t1.PubDate, t1.Cost, t1.Retail, t1.Discount, t1.Category from Books t1 INNER JOIN BOOKAUTHOR t2 ON t1.ISBN = t2.ISBN where t1.ISBN = 0401140733

The above query will dispaly the attributes of table "Books" and of table "BOOKAUTHOR" for book ISBN 0401140733

<u>Repeat problem 1 but remove the WHERE statement </u>

After removing the where condition we will have following join query

select t1.Title, t1.ISBN, t2.AuthorID, t1.PubID, t1.PubDate, t1.Cost, t1.Retail, t1.Discount, t1.Category from Books t1 INNER JOIN BOOKAUTHOR t2 ON t1.ISBN = t2.ISBN

The above query will display all the mapping data of table "Books" and of Table "BOOKAUTHOR"

7 0
4 years ago
Write a program that will add the content of two counters every 45 seconds and place the result in an integer register.
nexus9112 [7]

Answer:

Explanation:

The following code is written in Java and runs a thread every 45 seconds that adds the two counters together and saves them in an integer variable called register. Then prints the variable. If this code runs 5 times it automatically breaks the loop. This can be changed or removed by removing the breakLoopCounter variable.

 public static void add_Counters(int counterOne, int counterTwo) {

       int register = 0;

       int breakLoopCounter = 0;

       try {

           while (true) {

               register += counterOne + counterTwo;

               System.out.println(register);

               Thread.sleep(45000);

               breakLoopCounter += 1;

               if (breakLoopCounter == 5) {

                   break;

               }

           }

       } catch (InterruptedException e) {

           e.printStackTrace();

       }

   }

5 0
3 years ago
ALSO PLZZZ HELP :P Suppose you are purchasing a game at a local retail store that comes on DVD. In order to install it on your l
zheka24 [161]
I think the answer is B: an optical drive
Hope this helps have a great night
8 0
3 years ago
Other questions:
  • List five types of system information that can be obtained from the windows task manager. how can you use this information to co
    5·1 answer
  • A _____ is a form of Web conferencing that uses streaming media technologies to broadcast video and/or audio over the Internet f
    15·2 answers
  • If you had a chance to see what your life would be like in 20 years
    8·1 answer
  • Many inventions have enabled us to use digital cameras. The biggest difference between traditional and digital cameras is that d
    10·1 answer
  • Preserving confidentiality, integrity, and availability is a restatement of the concern over interruption, interception, modific
    11·1 answer
  • ¿Qué significa PPO a nivel de programación?
    15·1 answer
  • sunglasses sunglasses sunglasses sunglasses sunglasses sunglasses sunglasses sunglasses sunglasses sunglasses i am a failure sun
    7·2 answers
  • Who wants brainliest? First to answer gets it....
    12·2 answers
  • Technology that transfers page images composed inside a computer directly to printing plates is called:
    10·1 answer
  • you are working in the headquarters of an organization and you're asked to deal with the interruption in services due to network
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!