OneCompiler

C++,Home work for follows:

  • Write a program that allows you to enter two numbers and output the larger one.

1 Answer

1 year ago by

#include <iostream>
using namespace std;
int main(){
int a,b;
cout<<"Enter the 1st number : ";
cin>>a;
cout<<"Enter the 2nd number : ";
cin>>b;
if(a>b){
cout<<"The greater number is "<<a;
}else{
cout<<"The greater number is "<<b;
}
}

1 year ago by pasang sherpa