fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(void) {
  5. /* the three numbers */
  6. int number1,number2, number3;
  7.  
  8. /* we will save the larger number here */
  9. int max;
  10.  
  11. /* read three numbers */
  12. cin >> number1;
  13. cin >> number2;
  14. cin >> number3;
  15.  
  16. /* we temporarily assume that the former number is the larger one */
  17. /* we will check it soon */
  18. max = number1;
  19.  
  20. /* we check if the second value is the largest */
  21. if(number2 > max)
  22. max = number2;
  23.  
  24. /* we check if the third value is the largest */
  25. if(number3 > max)
  26. max = number3;
  27.  
  28. /* we print the result */
  29. cout << "The largest number is " << max << endl;
  30.  
  31. /* we finish the program successfully */
  32. return 0;
  33.  
  34. }
Success #stdin #stdout 0s 4532KB
stdin
10
70
1
stdout
The largest number is 70