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
#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;
}
Comments
Leave a comment