Advertisement
Spocoman

03. Smallest of Three Numbers

Oct 26th, 2023
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void smallestNumber(int a, int b, int c) {
  6.     int result =
  7.         a < b && a < c ? a :
  8.         b < a && b < c ? b : c;
  9.  
  10.     cout << result << endl;
  11. }
  12.  
  13. int main() {
  14.     int n1, n2, n3;
  15.     cin >> n1 >> n2 >> n3;
  16.  
  17.     smallestNumber(n1, n2, n3);
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement