0
what's wrong in this code??
Many tall buildings, including hotels, skip the number 13 when numbering floors -- often going from floor 12 to floor 14. It is thought that the number 13 is unlucky. Write a program that will number 15 rooms starting from 1, skipping the number 13. Output to the console each room number in separate line. var countOfRooms = 15; // Your code here for (countOfRooms = 0; countOfRooms <= 15; countOfRooms++ ) { if (countOfRooms ==13) { continue; } console.log(countOfRooms + 0); }
10 Respostas
+ 7
NIKHIL SONAWANE
var countOfRooms = 15;
// Your code here
for (i = 1; i <=countOfRooms+1; i++){
if (i == 13){
continue;
}
console.log(i);
}
do try to understand what you missed. you are almost there.
+ 1
Starting from "1"
0
Insted of "0" ??
0
NIKHIL SONAWANE
Well you didn't understand the question properly. It is written in the question itself to start count from 1. So, it should count from 1 to 16 as we are skipping 13.
0
CHANDAN ROY correct me if am wrong
So var countOfRooms 16 and countOfRooms = 16 ??
0
var countOfRooms = 16;
// Your code here
for (countOfRooms = 1; countOfRooms <= 16; countOfRooms++ ) {
if (countOfRooms ==13) {
continue;
}
console.log(countOfRooms + 0);
}
Thanks it done 😁😁
0
var countOfRooms = 16;
// Your code here
var i=15;
for (i = 1; i <= countOfRooms; i++) {
if (i == 13) {
continue;
}
console.log(i );
}
0
var countOfRooms = 15;
// Your code here
var rooms = 1
for(rooms=1; rooms<=countOfRooms+1; rooms++){
if(rooms == 13){
continue
}
console.log(rooms)
}
0
I keep getting that i have no input driving me insane -
I have:
var countOfRooms = 15
//your code here
var i = countOfRooms
for (i=1; i <=16; i++) {
if (i ==13) {
continue;
}
console.log(i);
}
That wasnt copy and pasted i retyped it - even if I do it with the original variable or if assign a value to it again and ive had different variations of this and i keep getting No input -why? These are how the examples are presented and they run without issue? HELP!! 🤞
0
var countOfRooms = 15;
// Your code here
for (i = 1; i <=countOfRooms+1; i++){
if (i == 13){
continue;
}
console.log(i);
}
Good Luck