Java program using scanner method.
write a
program to pass 2 integer numbers as parameters. If either of the two numbers is 0, display
valid entry and the program should end, if it is a valid entry, divide the larger number with the smaller
number and display the result.
Answers
Answered by
12
import java.util.*;
public class Integer
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int a,b,c,d,e;
System.out.println("Enter the two numbers");
a= in.nextInt();
b = in.nextInt();
if(a=0||b=0)
{
System.out.println("Its a valid entry");
}
elseif
{
c=Math.max(a,b);
d=Math.min(a,b);
e=(c/d);
System.out.println("The result is =" +e);
}
}
}
Similar questions
Computer Science,
6 months ago
Physics,
6 months ago
Math,
6 months ago
Social Sciences,
1 year ago
English,
1 year ago