Posted by : Unknown Sunday, 28 June 2015


class arithmetic
{
    public static void main(String args[])
    {
        short x = 8;
        int y = 2;
        float a = 10.5f;
        float b = 6f;
        System.out.println("Addition: "+(x+y));
        System.out.println("Subtraction: "+(x-y));
        System.out.println("Multiplication: "+(x*y));
        System.out.println("Division: "+(x/y));
        System.out.println("Modulus: "+(x%y));
        System.out.println("Floating point Division: "+(a/b));
    }
}

Output:

Addition: 10
Subtraction: 6
Multiplication: 16
Division: 4
Modulus: 0
Floating point Division: 1.75

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Welcome to My Blog

Translate

Popular Post

Total Pageviews

Blog Archive

- Copyright © Learning Java Program - Powered by Blogger -