File tree Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ // Use IntelliSense to learn about possible attributes.
3+ // Hover to view descriptions of existing attributes.
4+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+ "version" : " 0.2.0" ,
6+ "configurations" : [
7+
8+
9+ {
10+ "type" : " node" ,
11+ "request" : " launch" ,
12+ "name" : " Launch Program" ,
13+ "skipFiles" : [
14+ " <node_internals>/**"
15+ ],
16+ "program" : " ${workspaceFolder}\\ skip-odd.js"
17+ }
18+ ]
19+ }
Original file line number Diff line number Diff line change 1+ /* Problem-2
2+ display odd number from 55 to 85 and skip the numbers divisible by 5.
3+ */
4+ // Solution-1 by While loop
5+ let i = 55 ;
6+ while ( i <= 85 ) {
7+ i ++ ;
8+ if ( i % 2 === 0 || i % 5 === 0 ) {
9+ continue ;
10+ }
11+ console . log ( i ) ;
12+ }
13+
14+ // Solution-2 by for loop
15+ for ( let j = 55 ; j <= 85 ; j ++ ) {
16+ if ( j % 2 === 0 || j % 5 === 0 ) {
17+ continue ;
18+ }
19+ console . log ( j ) ;
20+ }
Original file line number Diff line number Diff line change 1+ /* Problem-1
2+ Write a loop to print even numbers from 1 to 40. Use continue to skip odd numbers.
3+ */
4+
5+ // Solution-1 by While loop
6+ let i = 1 ;
7+ while ( i <= 40 ) {
8+ i ++ ;
9+ if ( i % 2 === 1 ) {
10+ continue ;
11+ }
12+ console . log ( i ) ;
13+ }
14+
15+ // Solution-2 by for loop
16+
17+ for ( let j = 1 ; j <= 40 ; j ++ ) {
18+ if ( j % 2 === 1 ) {
19+ continue ;
20+ }
21+ console . log ( j ) ;
22+ }
You can’t perform that action at this time.
0 commit comments