import java.io.*;
class Sales
{
public static void main(String as[]) throws Exception
{
double sp,cp,perc;
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
System.out.println("Enter Cost price of an article:");
cp=Double.parseDouble(br.readLine());
System.out.println("Enter Cost price of an article:");
sp=Double.parseDouble(br.readLine());
perc=((sp-cp)/cp)*100;
if(perc<0)
System.out.println("Loss percentage="+perc+"%");
else if(perc>0)
System.out.println("Gian percentage="+perc+"%");
else
System.out.println("No Profitm, No Loss");
}
}
/* Output: */
Enter Cost price of an article:200
Enter Cost price of an article:250
Gian percentage=25.0%
0 comments:
Post a Comment