write an algorithm to input the cost price and the selling price of an article and calculate either profit and profit percent or loss and loss percent with steps..
Answers
Answer:
import java.util.Scanner;
public class KboatProfit
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter cost price of the article: ");
double cp = in.nextDouble();
System.out.print("Enter selling price of the article: ");
double sp = in.nextDouble();
double pl = sp - cp;
double percent = Math.abs(pl) / cp * 100;
if (pl > 0) {
System.out.println("Profit = " + pl);
System.out.println("Profit % = " + percent);
}
else if (pl < 0) {
System.out.println("Loss = " + Math.abs(pl));
System.out.println("Loss % = " + percent);
}
else {
System.out.println("Neither profit nor loss");
Answer:
plse help plse complete my 50 BRAINLIAST for be genius I will promise I will give you that you will tell have a great day 25 need BRAINLIAST answer I need more 16 BRAINLIAST answer
Explanation:
I done followed