Computer Science, asked by groshni, 8 months ago

write a program to assign price and quantity of the product (in decimal) .Calculate the total cost, 12% flat discount on the total cost and the net price to be paid , print all the data as output (please help me)​

Answers

Answered by riyakhatua76
4

Explanation:

SOLUTION:import java.io.*;

public class Percentage

{

public static void main(String args[])throws IOException

{

int cp,sp,p,l;

InputStreamReader read=new InputStreamReader(System.in);

BufferedReader in=new BufferedReader(read);

System.out.println("Enter Cost Price");

cp=Integer.parseInt(in.readLine());

System.out.println("Enter Selling Price");

sp=Integer.parseInt(in.readLine());

if (sp>cp)

{

p=sp-cp/cp*100;

System.out.println("Profit Percentage="+p);

}

else if (cp>sp)

{

l=cp-sp/cp*100;

System.out.println("Loss Percentage="+l);

}}}

.

Similar questions