Java program to compute expression and print output.

EX: Write a java program to calculate the expression and print output. How to write a java program which will compute expression and print output on the output screen. java program to compute expression and print output.


Program to compute expression:

public class ComputeExpression {

        public static void main(String[] args){

            //Add expression which you want to calculate
            System.out.println((15 * 5 + 25.5 * 5.5) / (55.5 - 4.5));

        }

}
Above java program shows the following output:

4.220588235294118


No comments:

Post a Comment

If you have any doubts, please discuss here...👇