Advertisement
Subrata_Nandi

Max_between_three

Sep 19th, 2023
546
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int a,b,c;
  6.     // cin>>a>>b>>c;
  7.  
  8.     cout<<"Enter first no : ";
  9.     cin>>a;
  10.  
  11.     cout<<"Enter second no : ";
  12.     cin>>b;
  13.    
  14.     cout<<"Enter third no : ";
  15.     cin>>c;
  16.  
  17.     if(a>b) {
  18.         if(a>c) {
  19.             cout<<a<<" is max";
  20.         } else {
  21.             cout<<c<<" is max";
  22.         }
  23.     } else {
  24.         if(b>c) {
  25.             cout<<b<<" is max";
  26.         } else {
  27.             cout<<c<<" is max";
  28.         }
  29.     }
  30.     return 0;
  31. }
  32.  
  33. //Output
  34.  
  35. Enter first no : 12
  36. Enter second no : 56
  37. Enter third no : 23
  38. 56 is max
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement