Coding | Mcqs | Multiple choice questions | Informative | Computer Science | Engineering | Aptitude | Quants | Verbal

INFEED

c++ very easy part 5 triangle smallest side

  The lengths of the sides of a triangle X, Y and Z are passed as the input. The program must print the smallest side as the output.

Input Format:
The first line denotes the value of X.
The second line denotes the value of Y.
The third line denotes the value of Z.

Output Format:
The first line contains the length of the smallest side.

Boundary Conditions:
1 <= X <= 999999
1 <= Y <= 999999
1 <= Z <= 999999

Example Input/Output 1:
Input:
40
30
50

Output:
30

Example Input/Output 2:
Input:
15
15
15

Output:
15

Code

#include<bits/stdc++.h>

using namespace std;


int main()
{
    int a,b,c;
    cin>>a>>b>>c;
if(a<b && a<c)
cout<<a;
else if(b<c)
cout<<b;
else
cout<<c;

}

Post a Comment

Previous Post Next Post