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 by anonymous

18 Answers

–1 vote
answered Aug 10 by anonymous
a = input().split(' ')
print(max(int(a[0]),int(a[1])))
–1 vote
answered Aug 10 by anonymous
x=23

y=55

ifx>y:

print(x)

else:

print(y)
commented Aug 20 by SWengineer
There is no standard print() function in C++. There is printf() from C, though.
–1 vote
answered Aug 11 by (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;
}
–1 vote
answered Aug 11 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");
}
+1 vote
answered Aug 14 by (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;
}
+1 vote
answered Aug 14 by (160 points)
#include<iostream>

using namespace std;

int main()

{

  int x,y;

cin>>x>>y;

cout<<max(x,y)<<endl;

return 0;

}
+1 vote
answered Aug 14 by anonymous
x = int(input())

y = int(input())

if x>y:

    print(x)

else:

    print(y)
0 votes
answered Aug 15 by (140 points)
int a = 1, b = 5;
printf("Max = %d", a>b?a:b);
0 votes
answered Aug 16 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;

}
0 votes
answered Aug 18 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)
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.
...