# Answer to Question #3558 in Java | JSP | JSF for Y mukundareddy

Question #3558

(1) Write a program to perform all arithmetic operators on the following variables a=5, b=10?

Expert's answer

public class Arifmetic {

public static void main(String[] args){

& int a = 5;

& int b = 10;

& int plus = a+b;

& int minus = a-b;

& int mult = a*b;

& double div = (double) a/b;

& System.out.println(a+" + "+b+" = "+plus);

& System.out.println(a+" - "+b+" = "+minus);

& System.out.println(a+" * "+b+" = "+mult);

& System.out.println(a+" / "+b+" = "+div);

}

}

public static void main(String[] args){

& int a = 5;

& int b = 10;

& int plus = a+b;

& int minus = a-b;

& int mult = a*b;

& double div = (double) a/b;

& System.out.println(a+" + "+b+" = "+plus);

& System.out.println(a+" - "+b+" = "+minus);

& System.out.println(a+" * "+b+" = "+mult);

& System.out.println(a+" / "+b+" = "+div);

}

}

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment