Tuesday, January 22, 2019

Minimum of three different integers

Write a program that reads three numbers and prints their minimum.

Input: Input consists of three different integer numbers.

Output : Print a line with the minimum of the three numbers.

#include <iostream>
using namespace std;

int main() {
    int l, m, n;
    cin >> l >> n >> m;
    if (n < l and n < m) cout << n << endl;
    else if (m < n and m < l) cout << m << endl;
    else cout << l << endl;
}

No comments:

Post a Comment

Modelo OSI

Open System Interconnection , Interconexión de Sistemas Abiertos, es un modelo para estudiar las categorías en que se pueden dividir los pr...