Pages - Menu

Pages

Wednesday, December 16, 2015

Java program to print the Division of 2 numbers with Scanner


Division of two numbers with Scanners:

import java.util.*;
public class Div
{
    public static void main()
    {
        Scanner sc=new Scanner(System.in);
        int a,b,result;
        System.out.println("Please enter 2 numbers");
        a=sc.nextInt();
        b=sc.nextInt();
        result=a/b;
        System.out.println("Division is "+result);
    }
}

Thank you and make sure to like and comment.

No comments:

Post a Comment