Advertisements
Advertisements
प्रश्न
A dealer allows his customers a discount of 25% and still gains 25%. Write a program to input the cost of an article and display its selling price and marked price.
[Hint: SP = `((100 + p%)/100)` * CP and MP = `(100/(100 − d%))` * SP]
संक्षेप में उत्तर
उत्तर
import java.util.*;
public class KboatCalculatePrice
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.print("Enter cost price of article: ");
double cp = in.nextDouble();
int disc = 25, profit = 25;
double sp = 0.0, mp = 0.0;
sp = ((100 + profit) / 100.0) * cp;
System.out.println("Selling price of article = Rs. " + sp);
mp = (100.0 / (100 - disc)) * sp;
System.out.println("Marked price of article = Rs. " + mp);
}
}
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?