KnowledgeBoat Logo

Computer Applications

Write a program to find and display the percentage difference, when a number is updated from 7.5 to 7.2

Java

Java Operators

68 Likes

Answer

public class KboatPercentIncrease
{
    public static void main(String args[]) {
        double orgNum = 7.5;
        double newNum = 7.2;
        double inc = newNum - orgNum;
        double p = inc / orgNum * 100;
        System.out.println("Percentage Difference = " + p + "%");
    }
}

Variable Description Table

Program Explanation

Output

BlueJ output of Write a program to find and display the percentage difference, when a number is updated from 7.5 to 7.2

Answered By

43 Likes


Related Questions