0

Can anybody help me answer this

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. Input 1 = 150 Input 2 = 100 Input 3 = 1500

20th Apr 2021, 3:18 PM
Darren Ardhianata
Darren Ardhianata - avatar
7 Answers
+ 2
Darren Ardhianata Don't pass Hard Code value as input. Also it's JavaScript not Java. Here is right solution function main() { var oldPrice = parseInt(readLine(), 10) var discount = oldPrice - oldPrice * 20 / 100; console.log(discount); }
20th Apr 2021, 4:26 PM
A͢J
A͢J - avatar
+ 2
Thank you so much dude
20th Apr 2021, 4:30 PM
Darren Ardhianata
Darren Ardhianata - avatar
0
Darren Ardhianata This is problem not a question so try to do self. Just calculate 20 % for the given inputs.
20th Apr 2021, 3:45 PM
A͢J
A͢J - avatar
0
I don't know how to code it so just only one of them can be solved but not the 2 more
20th Apr 2021, 3:58 PM
Darren Ardhianata
Darren Ardhianata - avatar
0
Hi! Please, show us your code attempt!
20th Apr 2021, 4:07 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
20th Apr 2021, 4:10 PM
Darren Ardhianata
Darren Ardhianata - avatar
0
If i code that way the second one doesnt get solved
20th Apr 2021, 4:11 PM
Darren Ardhianata
Darren Ardhianata - avatar