Basic Programming Q - Wap to enter cp and sp of an article print
out profit % or Loss % .
Answers
Answered by
0
Answer:
java program is given below.
Explanation:
class profitandLoss
{
public static void main(String args[])
{
Scanner s= new Scanner(System.in);
System.out.println("Enter the Costprice ");
double cp=s.nextDouble();
System.out.println("Enter the Selling price:");
double sp=s.nextDouble();
if(cp-sp>0)
{
System.out.println("loss:" +(cp-sp));
}
else if(cp-sp<0)
{
System.out.println("profit:" +(sp-cp));
}
else
System.out.println("NEUTRAL");
}
}
Similar questions