Nearest Restaurant challenge (JavaScript) | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Nearest Restaurant challenge (JavaScript)

Hi everyone, I don't understand how to complete this challenge in the JavaScript introduction, can someone please help me to solve this? (ᗒᗣᗕ)՞ "Nearest Restaurant A group of buildings has a restaurant on every 5th floor. In other words, a building with 12 floors has restaurants on the 5th and 10th floors. The given code takes the number of floors as input. Task Complete the code to output the floors that have restaurants. Sample Input 17 Sample Output 5 10 15"

10th Oct 2023, 11:49 AM
Yume
Yume - avatar
15 Respuestas
+ 2
Yume , So what do want,ready-made code? where are your try/attemp? Note that: Providing `readymade` code, this feature is not available here.First Try by yourself,after this if you face any problems in during learning or making code then ask here.. Otherhand, If you're having trouble in code, share your code and describe what error message you're receiving. without watching no one can figure out what's going wrong. D1M3 , don't try to give direct answers.. just give only hints and Let him try himself.
10th Oct 2023, 11:59 AM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
+ 2
Yume , If you don't know how to start, Plz repeat the lesson again and then try. If any problem arises after that then ask here..
10th Oct 2023, 12:19 PM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
+ 1
D1M3 Tbh, I don't have a single line of code for this challenge, I don't even know where to start, lol! :') Darpan kesharwani🇮🇳 I'm not asking for a ready-made code but rather for possible solutions/explanations, I really don't understand how to go about this code but I'm tryin' my best. >w<'
10th Oct 2023, 12:07 PM
Yume
Yume - avatar
+ 1
Yume, you said you do have a working code in Python, didn't you? Why not show your code in Python, then we can examine it and help you to translate into JavaScript?
10th Oct 2023, 1:10 PM
Wong Hei Ming
Wong Hei Ming - avatar
0
Use for loops
10th Oct 2023, 11:51 AM
D1M3
D1M3 - avatar
0
Like: for(int i = 0;i < floors;i++); This is c++
10th Oct 2023, 11:51 AM
D1M3
D1M3 - avatar
0
I already tried, I figured out how to do it with Python but I can't find the solution with JavaScript... ;w;
10th Oct 2023, 11:56 AM
Yume
Yume - avatar
0
Could you sent me your Code?
10th Oct 2023, 11:57 AM
D1M3
D1M3 - avatar
0
Darpan kesharwani🇮🇳 Alr did But If He cant solve it him selv
10th Oct 2023, 12:02 PM
D1M3
D1M3 - avatar
0
Create an var/int Name it Like "floor" Than create a 'for Loop' Like this : for(int i = 0;i < floors;i++){
10th Oct 2023, 12:11 PM
D1M3
D1M3 - avatar
0
Put in a 'if' Use it an Array and Look If its 0 when you use %5
10th Oct 2023, 12:13 PM
D1M3
D1M3 - avatar
0
D1M3 Thank you very much for your explanations, I'll try with this, I'll let you know when I have solved it! \o/ Darpan kesharwani🇮🇳 By the way, I've already tried but if I'm asking for advice here, maybe it's because I can't find the solution on my own, don't you think so? ^^'
10th Oct 2023, 12:33 PM
Yume
Yume - avatar
0
Wong Hei Ming I just solved it, thanks again to D1M3 for his explanations, I finally understood everything! ( ˙꒳˙ )
10th Oct 2023, 1:49 PM
Yume
Yume - avatar
0
let floors = 20; for (let x=0; x<=floors; x+=5){ if(x==0){ continue; } console.log(x); }
10th Nov 2023, 4:00 AM
Ahmed Abd El-Awal
0
Ahmed Abd El-Awal That's exactly what I did in the end but thanks, now I know I could hardly have done better! 😆
15th Nov 2023, 9:20 PM
Yume
Yume - avatar