Copy to Clipboard console.log("Print the following series using for loop:- 1,8,27,64,125,216,......n"); let n ; function cubeseriesloop(n){ for(let i=0; i =0){ console.log(cubei); }else{ break; } } } console.log(cubeseriesloop(9));
Write a program to print all odd numbers from 1 to n using for loops Example:- Input :- n=7 Output :- 1 3 5 7(JS)
Write a program to print all odd numbers from 1 to n using for loops Example:- Input :- n=7 Output :- 1 3 5 7
console.log(
"Write a program to print all odd numbers from 1 to n using for loops"
);
let n ;
function OddNum(n){
for(i=0; i<=n; i++){
if(i%2!==0){
console.log(i);
}
}
}
console.log(OddNum(9));
Comments
Post a Comment