10th Dec 2020, 7:08 AM
Isabel Thompson
Isabel Thompson  - avatar
20 Respostas
+ 3
First u need to take user input i.e. Price of the item. Then u need to perform a small calculation price-=20/100*price Then output the discounted price. Hope u understand the Question and algorithm.
10th Dec 2020, 8:07 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 3
Isabel Thompson First you need to create a variable and assign an input to it. You can make the input expect by changing it to parseInt(readLine(), 10) Hope you know how to find the discount. Define the discount as a variable and use console.log() to get the output. By the way, I gave some hints. Try to finish it yourself. Show your try if you can't solve it.
10th Dec 2020, 8:09 AM
Simba
Simba - avatar
+ 3
//try this function main() { var inp = parseInt(readLine(), 10); var total = 80/100 *inp; console.log(total ) }
11th Dec 2020, 6:18 AM
Simba
Simba - avatar
+ 3
Here is one of the ways to put it: function main() { var oldPrice = parseInt(readLine(), 10) var discount = oldPrice*20/100 console.log (oldPrice-discount) }
17th Feb 2021, 3:42 AM
Sergii Poberezhniuk
Sergii Poberezhniuk - avatar
+ 2
What's wrong in this Question??
10th Dec 2020, 7:47 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 1
Isabel Thompson , it's easy. As a hint read the input like an int type. Perform the calculation - 20% discount means => new price is 80% * old price. Output the result.
10th Dec 2020, 8:06 AM
TheWhĀ”teCat šŸ‡§šŸ‡¬
TheWhĀ”teCat šŸ‡§šŸ‡¬ - avatar
+ 1
Hi guys, thank you all for the help. I stil dont get it. var inp = 20/100*100; var total = 100 - inp; console.log(total); still wrong! what am I doing wrong??
11th Dec 2020, 5:58 AM
Isabel Thompson
Isabel Thompson  - avatar
0
yes, how can I do it?
10th Dec 2020, 7:26 AM
Isabel Thompson
Isabel Thompson  - avatar
0
Time to go shopping! Everything in a store has been discounted by 20%. Youā€™re given a program that takes the price of an item as input. Complete the program so that itā€™ll output the discounted price to the console. Sample Input 100 Sample Output 80
10th Dec 2020, 7:46 AM
Isabel Thompson
Isabel Thompson  - avatar
0
i dont know how to do it. Can someone explain??
10th Dec 2020, 7:54 AM
Isabel Thompson
Isabel Thompson  - avatar
0
Hey it can be done using getter and setter method Can you give me code bcoz this link is only for PRO
12th Dec 2020, 6:32 AM
born2code
born2code - avatar
0
It is same like this code Just u need to do some changes https://code.sololearn.com/c5sKe25X695x/?ref=app If you not understand give me full code not link , So can i understad u.
12th Dec 2020, 6:38 AM
born2code
born2code - avatar
0
Guy, Iā€™m trying to solve it in JavaScrip... still not working.
27th Dec 2020, 5:16 AM
Isabel Thompson
Isabel Thompson  - avatar
0
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
27th Dec 2020, 5:16 AM
Isabel Thompson
Isabel Thompson  - avatar
0
//so we donā€™t overwhelm you, weā€™ve hidden the code that executes the input function main() { var oldPrice = parseInt(readLine(), 10) // your code goes here const discount = oldPrice * 20/100; const newPrice = oldPrice - discount; console.log(newPrice); }
9th Nov 2021, 11:23 AM
Chedrac GUEDENON
0
//so we donā€™t overwhelm you, weā€™ve hidden the code that executes the input function main() { var oldPrice = parseInt(readLine(), 10) // your code goes here var discount = (20/100*oldPrice); var total = oldPrice -discount ; console.log(total) ; }
22nd Feb 2022, 2:38 AM
Srividya Pettem
- 2
would like to practice for beginners
12th Dec 2020, 2:54 AM
Pancho