aakash2310

Untitled

Feb 21st, 2022
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. import java.util.*;
  2. class ArithMaticExcep
  3. {
  4.     public static void main(String[] args)
  5.     {
  6.         Scanner sc=new Scanner(System.in);
  7.         int i=0;
  8.         int j=0;
  9.         try{
  10.             System.out.print("Enter I : ");
  11.              i=sc.nextInt();
  12.              System.out.print("Enter J : ");
  13.             j=sc.nextInt();
  14.             float Divide=i/j;
  15.             System.out.println("i/j"+(i/j));
  16.         }
  17.         catch(ArithmeticException e)
  18.         {
  19.             System.out.println(i+" cannot be divide by "+j);
  20.             System.out.println("Because "+e);
  21.         }
  22.         finally
  23.         {
  24.             System.out.println("Thank You");
  25.         }
  26.  
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment