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
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);
}
+ 2
Thank you so much dude
0
Darren Ardhianata
This is problem not a question so try to do self.
Just calculate 20 % for the given inputs.
0
I don't know how to code it so just only one of them can be solved but not the 2 more
0
Hi! Please, show us your code attempt!
0
If i code that way the second one doesnt get solved