Write a program in java
A shopkeeper announces two successive discounts 20% and 10% on purchasing of goods on the marked price. Write a program to input marked price and calculate the selling price of an article.
Answers
Answered by
10
System.out.println("Gian percentage="+perc+" %");. else. System.out.println("No Profitm, No Loss");. } } /* Output: */. Enter Cost price of an ...
Answered by
11
The body of the following java program to take the marked price as an input and print the selling price of the product is as follows :
{
double mp,ip,sp;
int d1=20,d2=10;
Scanner sc= new Scanner(System.in);
System.out.println("Enter the marked price of the product");
mp = sc.nextLine();
ip=mp-(d1*mp/100);
sp=ip-(d2*ip/100);
System.out.println("The selling price of the product is :" +sp);
}
- The variables used store the various values as required.
- Scanner class is used to take an input from the user.
- 'sc' is an object of the scanner class.
Similar questions