//Max between 3 nos.
import java.util.Scanner;
class Max_3 {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter 3 nos:");
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
if((a==b)&&(b==c))
System.out.println("All 3 are equal.");
else if(a>b && (a>c || b==c))
System.out.println("Max="+a);
else if(b>c && (b>a || a==c))
System.out.println("Max="+b);
else
System.out.println("Max="+c);
}
}
import java.util.Scanner;
class Max_3 {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter 3 nos:");
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
if((a==b)&&(b==c))
System.out.println("All 3 are equal.");
else if(a>b && (a>c || b==c))
System.out.println("Max="+a);
else if(b>c && (b>a || a==c))
System.out.println("Max="+b);
else
System.out.println("Max="+c);
}
}
No comments:
Post a Comment