//Determine whether(and how much) profit or loss is incurred
import java.util.Scanner;
class ProfitOrLoss {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter Selling Price and Cost Price(respectively):");
float sp=sc.nextFloat();
float cp=sc.nextFloat();
if(sp==cp)
System.out.println("Neither profit nor loss");
else if(sp>cp)
System.out.println("Profit="+(sp-cp));
else
System.out.println("Loss="+(cp-sp));
}
}
import java.util.Scanner;
class ProfitOrLoss {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter Selling Price and Cost Price(respectively):");
float sp=sc.nextFloat();
float cp=sc.nextFloat();
if(sp==cp)
System.out.println("Neither profit nor loss");
else if(sp>cp)
System.out.println("Profit="+(sp-cp));
else
System.out.println("Loss="+(cp-sp));
}
}
No comments:
Post a Comment