Computer Science, asked by nadim93, 8 hours ago

write a program in bluej to input the cost price and the selling price. if the selling price is more than the cost price then calculate and display actual profit or profit percentage, other wise calculate and display actual loss and loss percentage. if the cost price and selling price are equal the the program displays 'Neither profit nor loss'

plz don't give rubbish answers​

Answers

Answered by eshanshinde52
2

Answer:

import java.util.*;

public class cost

{

public static void main(String args[])

{

Scanner in =new Scanner (System.in);

int cp,sp,p,l;

System.out.println("Enter the cost price and selling price of the item");

cp=in.nextInt();

sp=in.nextInt();

if(sp>cp)

{

p=sp-cp;

System.out.println("Profit on the item is"+p);

}

if(sp<cp)

{

l=cp-sp;

System.out.println("Loss on the item is "+l);

}

else if (sp==cp)

System.out.println("Neither Profit nor loss");

}

}

Similar questions