//Min between 3 nos
import java.util.Scanner;
public class Min_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("Min="+a);
else if(b<c && (b<a || a==c))
System.out.println("Min="+b);
else
System.out.println("Min="+c);
}
}
import java.util.Scanner;
public class Min_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("Min="+a);
else if(b<c && (b<a || a==c))
System.out.println("Min="+b);
else
System.out.println("Min="+c);
}
}
No comments:
Post a Comment