Generate Arithmetic exception in java

Write a program to generate Arithmetic exception in java.

package Exception_demo;

import java.util.*;
public class exception_1 
{
    public static void main(String args[])
    {
        int a,b,c=0;
        Scanner s=new Scanner(System.in);
        System.out.println("enter the value of a:");
        a=s.nextInt();
        System.out.println("enter the value of b:");
        b=s.nextInt();
        c=a/b;
        System.out.println("value of c is:"+c);
        System.out.println("bhavesh jain");
        
    }
    
}

Leave a Reply

Your email address will not be published. Required fields are marked *