Answer to Question #296891 in C++ for ProgramTraining

Question #296891

Write a program whose inputs are three integers, and whose output is the smallest of the three values. 

Ex: If the input is: 

7 15 3

the output is: 

3




1
Expert's answer
2022-02-12T04:41:25-0500
# include <iostream>


// function that finds the smallest of two integers
int min(int a, int b) { return ((a < b) ? a : b); }


int main() {
	int a, b, c;
	std::cin >> a >> b >> c;
	std::cout << min(min(a, b), c);
}

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