Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Write a program to enter the value of two variables (X and Y). Find and print themaximum value for two variables.

0 votes
asked Aug 9, 2019 by anonymous

18 Answers

0 votes
answered Aug 18, 2019 by Ravi Pancharia (210 points)
#include<iostream>
using namespace std;
int main()
{int n,m;
cout<<"enter the value of n=";
cin>>n;
cout<<"enter the value of m=";
cin>>m;
if(m>n)
cout<<"m is greater then n";
}

//comment=
enter the value of n=2                                                                                                         
enter the value of m=3                                                                                                         
m is greater then n
0 votes
answered Aug 19, 2019 by Raghul
#include <stdio.h>

int main()
{
    int x,y,z;
    printf("Enter the value of x and y\n");
    scanf("%d %d",&x,&y);
    
    z = (x>y) ? x:y;
    printf("%d",z);
    return 0;
}
0 votes
answered Aug 20, 2019 by rv singh
x=int(input("enter the fitrst no"))

y=int(input("enter thye second no"))

if(x>y):

print("x is greater")

else:

print("y is greater")
0 votes
answered Aug 20, 2019 by Sivani
#include <stdio.h>
 int main()
    {
    int x,y;
    x=2;
    y=5;
    if(x>y)
     {
       printf("x is maximum");
     }
    else
      {
        printf("y is maximum");
       }
     }
0 votes
answered Aug 21, 2019 by bhoomi2000 (780 points)

#include<stdio.h>

#include<conio.h>

void main()

{

       int a,b;

       â€‹scanf("%d%d",&a,&b);

       if (a>b)

       printf("max is: %d\n",a);

       if (a<b);

       printf("max is: %d\n",b);

       getch();

}

0 votes
answered Aug 21, 2019 by anonymous
x=int(onput())

y=int(input())

if x>y::

print (x)

else:

print(y)
0 votes
answered Aug 21, 2019 by noobie
x=int(input("enter first num: "))

y=int(input("enter second num:"))

z=max(x,y)

print("large :",z)
0 votes
answered Aug 22, 2019 by Suhas Gowda
//java program
class main
{
public static void main(String args[])
{
int x=Integer.parseInt(args[0]);
int y=Integer.parseInt(args[1]);
int m=Math.max(x,y);
System.out.println(""+m);
}
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...