Friday, May 18, 2012

Simple Arithematic Operations in JAVA


import java.io.*;
class arith
{   public static void main(String arg[]) throws IOException
    {     int a,b,c;
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          a = Integer.parseInt(br.readLine());
          b = Integer.parseInt(br.readLine());
          c = a+b;
          System.out.println("Addition is " +c);
          c = a-b;
         System.out.println("Substraction is " +c);
          c = a*b;
       System.out.println("Multiplication is " +c);
          c = a/b;
         System.out.println("Division is " +c);
          c = a%b;
          System.out.println("Modulus is " +c);
     }
}

No comments:

Post a Comment