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.
0
votes
asked
Aug 9, 2019
by
anonymous
Your answer
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
18 Answers
–1
vote
answered
Aug 10, 2019
by
anonymous
a = input().split(' ')
print(max(int(a[0]),int(a[1])))
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
–1
vote
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.
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
–1
vote
answered
Aug 11, 2019
by
Abhinandan Jain
(
120
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;
}
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
–1
vote
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");
}
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
+1
vote
answered
Aug 14, 2019
by
yuvraj
(
300
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;
}
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
+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;
}
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
+1
vote
answered
Aug 14, 2019
by
anonymous
x = int(input())
y = int(input())
if x>y:
print(x)
else:
print(y)
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
0
votes
answered
Aug 15, 2019
by
Vasilij
(
140
points)
int a = 1, b = 5;
printf("Max = %d", a>b?a:b);
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
0
votes
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;
}
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
0
votes
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)
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
Page:
1
2
next »
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.
...