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 is 1 of the rules for naming variables?
vova2212 [387]

Answer:

<h3>Rules for Naming Variables</h3><h3>The first character must be a letter or an underscore (_). You can't use a number as the first character. The rest of the variable name can include any letter, any number, or the underscore. You can't use any other characters, including spaces, symbols, and punctuation marks.</h3>

<em><u>#</u></em><em><u>M</u></em><em><u>a</u></em><em><u>r</u></em><em><u>k</u></em><em><u>a</u></em><em><u>s</u></em><em><u>b</u></em><em><u>r</u></em><em><u>a</u></em><em><u>i</u></em><em><u>n</u></em><em><u>l</u></em><em><u>e</u></em><em><u>s</u></em><em><u>s</u></em><em><u>p</u></em><em><u>l</u></em><em><u>e</u></em><em><u>a</u></em><em><u>s</u></em><em><u>e</u></em><em><u>✅</u></em>

3 0
3 years ago
A healthcare organization received notification that a hospital employee’s laptop that contained PHI was inadvertently left at a
timofeeve [1]

Answer:

Implement better protection and inform the staff.

Explanation:

The situation given in the question can be very alarming for a healthcare organization since the laptops contain critical information and details about the employee's work.

To prevent this from occuring again in the future, the organization should educate their employees on cyber security and having a strong password. They also should implement softwares on the computers against such incidents, which can be softwares that can lock the computers and delete files that are important to the organization if an unauthorized entry is detected. In order to protect the information, they can also use a backup system for every computer the employee's use.

I hope this answer helps.

7 0
3 years ago
What is output if month = 11 and day = 14?
goldfiish [28.3K]

Cheese

…………………………..tggggggcfcgvgvv

4 0
3 years ago
Read 2 more answers
If you were to create a new app for a smartphone or tablet that does not already exist, what would you create?
omeli [17]
A app that fry’s your Phone or Tablet.
4 0
3 years ago
Which of the following statements is false? Question 16 options: A) With non-static interface methods, helper methods can now be
Delicious77 [7]

Answer:

The best answer is "A"

Explanation:

With non-static interface methods, helper methods can now be declared directly in interfaces rather than in separate classes.

5 0
3 years ago
Read 2 more answers
Other questions:
  • which is true someone with a low credit score I . they probably make on time payments ll . they may not be able to rent the apar
    14·2 answers
  • B.
    12·1 answer
  • To type a small letter "z", you would use the right little finger. (5 points)True False
    9·1 answer
  • You work part time at a computer repair store. You are in the process of building a new computer system. The customer wants a mo
    6·1 answer
  • Does access provide email communication
    13·1 answer
  • Which are emotional effects of anxiety? Check all that apply.
    10·2 answers
  • Which of the following would allow for the QUICKEST restoration of a server into a warm recovery site in a case in which server
    10·1 answer
  • Libby’s keyboard is not working properly, but she wants to select options and commands from the screen itself. Which peripheral
    14·1 answer
  • LAB: Praising dates
    14·1 answer
  • Draw the 2-3 tree that results when you insert the keys E A S Y Q U T I O N in that order into an initially empty tree
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!