Computer Applications

Write a program to find and display the value of the given expression:

(x + 3) / 6 - (2x + 5) / 3;

taking the value of x = 5

Java

Java Operators

230 Likes

Answer

public class KboatExpression
{
    public static void main(String args[]) {
        int x = 5;
        double value = ((x + 3) / 6.0) - ((2 * x + 5) / 3.0);
        System.out.println("Result = " + value);
    }
}

Variable Description Table

Program Explanation

Output

Answered By

107 Likes


Related Questions