How to calculate discount of product in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        double  discount, amount, price;
               
	    price = 9880;
 
        discount = 5;  // 5%

	    amount = ((100 - discount) * price) / 100;
 
	    System.out.println("Amount after discount = " + amount);
    }
}





/*
run:
 
Amount after discount = 9386.0
 
*/

 



answered Aug 15, 2021 by avibootz
...