- 2

how can help we with big sale of javacript excersie?

I complet one task but when I write another code it not accept what I should do to solve it

6th Feb 2021, 4:40 AM
Farhad Faqeri
Farhad Faqeri - avatar
6 odpowiedzi
+ 2
give link, description, specific question, and at least your attempt...
6th Feb 2021, 4:41 AM
visph
visph - avatar
+ 2
I don't get where the parseInt(readLine(), 10); part comes from.
21st Mar 2021, 12:23 AM
Gee Henry
Gee Henry - avatar
0
this is the solution. function main() { var oldPrice = parseInt(readLine(),10); console.log(oldPrice/100*80); }
13th Feb 2021, 12:39 PM
romeodelguasta
romeodelguasta - 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 //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 } ^That is the problem and I am also stuck... I tried like this: function main(){ var oldPrice = parseInt(readLine(),10) var percentage= (oldPrice*20/100); var newPrice =oldPrice - percentage; console.log(newPrice); ^It worked for 1 case but ask for at least 2 more different input and outputs (that was not in the question and also has 2 more "secret" answers). So I wondered if there is a way to make this var oldPrice has different values, I tried to give different values after the console.log and tested if the value changed but broke the code hahaha So please 🆘
22nd Mar 2021, 7:48 PM
Rhaná Teixeira
0
function main() { var oldPrice = parseInt(readLine(), 10) // your code goes here var newPrice= oldPrice*80/100 console.log(newPrice) }
28th Aug 2021, 3:31 PM
Santa Roqi
Santa Roqi - avatar
0
function main() { var oldPrice = parseInt(readLine(), 10) var discount = oldPrice * 20/100 var newPrice = oldPrice - discount console.log(newPrice) } I just found the discount first, and I deducted the discount from the old price. That gave me the new price. Simple
30th Dec 2021, 11:47 AM
Henry
Henry - avatar