Computer Science, asked by arshi70, 1 year ago

write a Java program to accept selling price and cost price and find profit n profit %​

Answers

Answered by Anonymous
4

PLEASE FOLLOW ME..........

Attachments:
Answered by vishva5000
2

Answer:

import java.util.*;

public class brainly

{

public static void main (String args [])

{

Scanner in=new Scanner (System.in);

int sp,cp,p,l;

double pp,lp;

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

cp=in.nextInt ();

sp=in.nextInt ();

if (sp > cp)

{

p=sp-cp;

pp=p*100.0/cp;

System.out.println("The profit is:"+p);

System.out.println ("The profit percent="+pp);

}

else if (sp <cp)

{

l=cp-sp;

lp=l*100.0/cp;

System.out.println("The loss :"+l);

System.out.println ("The loss percent:"+lp);

}

else

System .out.println ("neither profit nor loss");

}

}

Explanation:

Similar questions