Computer Science, asked by faisalalam73, 2 months ago

WAP to input the cost price and selling price of an article and find out Profit % or Loss %

Answers

Answered by nancy359
2

\boxed {\boxed{ { \green{ \bold{ \underline{Verified \: Answer \: }}}}}}

Solution:-

import java.util.*;

class program

{public static void main ( string args [ ])

{ Scanner sc = new Scanner ( System.in)

System.out.println("Input the cost price of the article")

int cp=sc.nextInt()

System.out.println("Input the selling price of the article")

int sp=sc.nextInt()

if(sp>cp)

int profit = sp - cp ;

int profit percent = (profit/cp)*100;

System.out.println("Profit ="+profit)

System.out.println("Profit percent =" + profit percent)

if(sp<cp)

int loss = cp - sp;

int loss percent = (loss / cp)*100;

System.out.println("Loss ="+loss)

System.out.println("Loss Percent ="+loss percent )

if(sp=cp)

System.out.println("Neither Profit nor loss ")}}

Answered by garimaupreti02
0

Explanation:

it's your answer I hope help you have a great day take care of yourself and your family

Attachments:
Similar questions