Arithmetic Operation in Java Programming

  • on February 4, 2019
  • Likes!
Hello friends! Welcome to my website
How to make a java programming for basic arithmetic operation by the simple method?
This java language programming is free all type of errors like compiler and runtime errors and this programming is tested to compile and then run the programming code. only programming and noting
Here is only programming code only with the there output.How to make basic arithmetic operation by simple method in java programming

//—- Code Start —-
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—–

Output:    Enter the first number:8
Enter the second number:4
                Arithmetic basic Operation result:
8 + 4 = 12
                8 – 4 = 4
                8 * 4 = 32
8 / 4 = 2
8 % 4 = 0
Note: Output of the Java programming depends on the input that entered by the Programmer
I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
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!
Article Categories:
Programs in java

Leave a Reply

Your email address will not be published. Required fields are marked *