Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Main Class
- import java.util.Scanner;
- public class Java{
- public static void main(String args[]){
- Scanner input = new Scanner(System.in);
- boolean done = false;
- while(done == false){
- try{
- System.out.println("Enter first number: ");
- int n1 = input.nextInt();
- System.out.println("Enter second number: ");
- int n2 = input.nextInt();
- int sum = n1/n2;
- System.out.println(sum);
- done = true;
- } catch(Exception e) {
- System.out.println("You can not divide by 0.12");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement