- 1

Calculate the discount percentage

Time to go shopping! Everything in the store has been discounted by 20%. You are given a program that takes the price of an item as input. Complete the program so that it outputs the discounted price to the console.  Sample Input 100  Sample Output 80  Explanation 20 percent of 100 equals to 20 (100 * 20/100), so the discounted price will be 80 (100 - 20).

22nd Feb 2021, 5:48 AM
Brijesh Nagar
Brijesh Nagar - avatar
5 Respuestas
+ 3
If you will show your attempts. It will be more easy to help you for us. Happy coding 👍
22nd Feb 2021, 11:02 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 1
Is this one of the Code Coach questions? If yes, try it yourself first! I heard this phrase that says doing it yourself just once is better than hearing 1000 times! (or something along that line since I forgot lol) Hint : if the discount is 20%, how much is the current price? 70? 80%? (This maths is so basic you can definitely do it lol) And then just multiply it with the price input and voila! You just solved the question! Oh, and use parseInt() to change string to number! Happy programming :)
22nd Feb 2021, 7:21 AM
TheCoder
0
I am very much worried, please give this question to Solve and I am learning JavaScript
22nd Feb 2021, 5:53 AM
Brijesh Nagar
Brijesh Nagar - avatar
0
// your code goes here var x = (oldPrice * 20/100) var x2 = oldPrice - x Console.log(x2)
25th Apr 2021, 10:26 PM
Mujtaba Naqvi
Mujtaba Naqvi - avatar
0
//Here's my code a = input() print((lambda x: x-(x*20/100))(a)) but, it's not working. Can anyone tell me what's wrong here, pls...
14th Aug 2021, 2:36 AM
Shaik Suhail