Answer to Question #177194 in C++ for Torres

Question #177194

create a program using selection control structure particularly if else statement that will input 3 numbers and will output which one has the smallest value


1
Expert's answer
2021-03-31T12:01:47-0400
#include <iostream>

using namespace std;

int main() { 

  int num1, num2, num3, min;


    cout << "Enter integer N_1: ";

    cin>> num1;

    cout << "Enter integer N_2: ";

    cin>> num2;

    cout << "Enter integer N_3: ";

    cin>> num3;


    min = num1;

    if(min > num2)

        min = num2;

    if(min > num3)

        min = num3;
    

    cout << "The smallest : " << min << endl;

   return 0;

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS