fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. double n1, n2, n3;
  7.  
  8. cout << "Enter three numbers:";
  9. cin >> n1 >> n2 >> n3;
  10.  
  11. //check if n1 is the largest number
  12. if(n1 >= n2 && n1 >= n3)
  13. cout << "Largest number:" << n1;
  14.  
  15. //check if n2 is the largest number
  16. else if(n2 >= n1 && n2 >= n3)
  17. cout << "Largest number:" << n2;
  18.  
  19. //if neither n1 or n2 are the largest, n3 is the largest
  20. else
  21. cout << "Largest number:" << n3;
  22.  
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0.01s 5460KB
stdin
34
89
90
stdout
Enter three numbers:Largest number:90