Header Ads Widget

C++ program to find the maximum between two numbers

 

 C++ program to find the maximum between two numbers

Given two numbers , write a program to find the maximum between both numbers .

Sample input:

5 4

Sample output:

5  is maximum

C++ program to find the maximum between two numbers

The objective of the code is to find the maximum between two numbers .

Code(C++):-

#include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b;
    cin>>a>>b;
    if(a>b)
     cout<<a<<" is maximum"<<endl;
    else
     cout<<b<<" is maximum"<<endl;
}

Output:-

5
4
5 is maximum

Recommended Post :-

HCL Coding Questions:-

Capgemini Coding Questions:-

Companies interview:-

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-