Computer Science, asked by drsunitharobert, 11 months ago

Can anyone plz help me Write a java program to Input selling price and cost price. Find the gain & gain % (or) loss and loss % .use if else if u answer correctly and fast i will mark you as the brainliest plz..............

Answers

Answered by allorasharma
1

Answer:

plz follow me or mark me as brainlist

Explanation:

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");

}

}

Hope it helps!!!

Answered by Anonymous
0

Answer:

Please mark me brainlist and follow me in brainly then I will answer to your question

Similar questions