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.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
Write a program to enter the value of two variables (X and Y). Find and print themaximum value for two variables.
+2
votes
asked
Aug 9, 2019
by
anonymous
Please
log in
or register to answer this question.
20 Answers
0
votes
answered
Aug 10, 2019
by
anonymous
a = input().split(' ')
print(max(int(a[0]),int(a[1])))
Please
log in
or register to add a comment.
0
votes
answered
Aug 10, 2019
by
anonymous
x=23
y=55
ifx>y:
print(x)
else:
print(y)
commented
Aug 20, 2019
by
SWengineer
There is no standard print() function in C++. There is printf() from C, though.
Please
log in
or register to add a comment.
0
votes
answered
Aug 11, 2019
by
Abhinandan Jain
(
140
points)
#include <stdio.h>
int main()
{
int a,b;
printf("enter your number ");
scanf("%d%d",&a,&b);
if (a>b)
{
printf("%d is greater ",a);
}
else
{
printf("%d is greater",b);
}
return 0;
}
Please
log in
or register to add a comment.
0
votes
answered
Aug 11, 2019
by
Lucifer
#include<stdio.h>
void main()
{
int a,b;
printf("Enter the two numbers:");
scanf("%d,%d",&a,&b);
if(a>b)printf("%d",a);
else if(a<b)printf("%d",b);
else printf("The two numbers are equal");
}
Please
log in
or register to add a comment.
+3
votes
answered
Aug 14, 2019
by
yuvraj
(
340
points)
#include <stdio.h>
int main()
{
int a,b;
printf("enter your number ");
scanf("%d%d",&a,&b);
if (a>b)
{
printf("%d is greater ",a);
}
else
{
printf("%d is greater",b);
}
return 1;
}
Please
log in
or register to add a comment.
+1
vote
answered
Aug 14, 2019
by
Deep Dhakad
(
160
points)
#include<iostream>
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
cout<<max(x,y)<<endl;
return 0;
}
Please
log in
or register to add a comment.
+1
vote
answered
Aug 14, 2019
by
anonymous
x = int(input())
y = int(input())
if x>y:
print(x)
else:
print(y)
Please
log in
or register to add a comment.
0
votes
answered
Aug 15, 2019
by
Vasilij
(
140
points)
int a = 1, b = 5;
printf("Max = %d", a>b?a:b);
commented
Feb 3, 2025
by
Faiyaz Ahmad
(
100
points)
i think it is the sortest way to write this programm
Please
log in
or register to add a comment.
+1
vote
answered
Aug 16, 2019
by
Ishika Jain
#include<stdio.h>
int main()
{
int x , y , z;
scanf("%d %d",&x,&y);
z = x>y?x:y;
printf("%d",z);
return 0;
}
Please
log in
or register to add a comment.
+1
vote
answered
Aug 18, 2019
by
anonymous
x=int(input("enter the number")
y=int(input("enter the number")
if(x>y):
print("greater value is",x)
else:
print("greater is",y)
Please
log in
or register to add a comment.
Page:
1
2
next »
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...