How to make a java programming for basic arithmetic operation by the simple method?
Here is only programming code only with the there output.How to make basic arithmetic operation by simple method in java programming
import java.util.Scanner; public class simplearithmetic {
public static void main(String[] args) {
//declaration of the variables and their types
int a, b, add, sub, multi, reminder, divistion;
//input
Scanner c = new Scanner(System.in);
System.out.print(“Enter the frist number: “);
a = c.nextInt();
System.out.print(“Enter The second number: “);
b = c.nextInt();
//opration logic
add = a + b;
sub = a – b;
multi = a * b;
divistion = a / b;
reminder = a % b;
//output of the progrmming code
System.out.println(“Airthmatic basic Oprtaion results:”);
System.out.println(a + ” + ” + b + ” = ” + add);
System.out.println(a + ” – ” + b + ” = ” + sub);
System.out.println(a + ” * ” + b + ” = ” + multi);
System.out.println(a + ” / ” + b + ” = ” + divistion);
System.out.println(a + ” % ” + b + ” = ” + reminder);
}
}
//—-code end—–
Enter the second number:4
Arithmetic basic Operation result:
8 + 4 = 12
8 – 4 = 4
8 * 4 = 32
8 / 4 = 2
8 % 4 = 0
If any dought about this java programming code or input & output please comment below
If you have other question about java programming send an email by contacting us form are given on page right side.
Thank You!