Write a program to input cost price and selling price and calculate the loss percentage and print.


import java.io.*;
public class loss
{
    public static void main() throws IOException
    {
BufferedReaderbr=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the cost price");
      double CP=Double.parseDouble(br.readLine());
System.out.println("Enter the selling price");
      double SP=Double.parseDouble(br.readLine());
    
        String item_name="Article";
        double loss=CP-SP;
        double loss_per=loss/CP*100;
System.out.println("The loss percent is="+loss_per);
    }
}
}
Enter the cost price 2000
Enter the selling price 1789
The loss percent is=10.549999999999999

LEAVE A REPLY

Please enter your comment!
Please enter your name here