পাঠ ৬.১: ক্লোজার লুক
public class DivideByZeroNoExceptionHandling {
public static int divide(int a, int b) {
return a / b;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Please enter an integer: ");
int a = scanner.nextInt();
System.out.println("Please enter another integer: ");
int b = scanner.nextInt();
int result = divide(a, b);
System.out.println(String.format("Result: %d/%d = %d", a, b, result));
}
}Last updated