fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. double a, b, c;
  6.  
  7. cout << "Enter the first number:";
  8. cin >> a;
  9.  
  10. cout << "Enter the second number:";
  11. cin >> b;
  12.  
  13. cout << "Enter the third number:";
  14. cin >> c;
  15.  
  16. double largest = a;
  17. double smallest = a;
  18.  
  19. if (b > largest) largest = b;
  20. if (c > largest) largest = c;
  21.  
  22. if (b < smallest) smallest = b;
  23. if (c < smallest) smallest = c;
  24.  
  25. cout << "The largest number is:" << largest << "\n";
  26. cout << "The smallest number is: " << smallest << "\n";
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Enter the first number:Enter the second number:Enter the third number:The largest number is:6.95333e-310
The smallest number is: 4.65079e-310