Max Program (Find the Max number)

public class Main
{
public static void main(String[] args) {
int x = 0;
int y = 1;
int max = x>y?x:y;

System.out.println("x = "+ x);
System.out.println("y = "+ y);
System.out.println("max = "+ max);
}
}
Output:
x = 0
y = 1
max = 1
======================
public class Main
{
public static void main(String[] args) {
int x = 4;
int y = 1;
int max;
if (x > y)
    max = x;
else
    max = y;
System.out.println("x = "+ x);
System.out.println("y = "+ y);
System.out.println("max = "+ max);
}
}
Output:
x = 4
y = 1
max = 4
===============
#input from user







একটি মন্তব্য পোস্ট করুন