Simple java programme to display the minimum of two numbers
PROGRAM:
public class Solution {
public static void main(String[] args) throws Exception {
System.out.println("Enter two numbers");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int a=Integer.parseInt(br.readLine());
int b=Integer.parseInt(br.readLine());
if((a <b)||(a==b))
System.out.println(a);
else if(a>b)
System.out.println(b);
}
}
OUTPUT:
Enter two numbers
33 25
25
ALTERATION:
To display the maximum of two numbers replace all <(less than symbol) with > (greater than symbol) and vice versa.
Comments
Post a Comment