complete_number-rhombus_structure(incomplete)

Run Settings
LanguageJavaScript
Language Version
Run Command
let i, j, k, n, m; let rows = 11; let s = ''; let l = 1; let rowsSecOne = parseInt((rows/2 + (rows%2))); let rowsSecTwo = parseInt(rows/2); for(i = 1; i <= rows; ++i){ m = parseInt(l/2 + (l%2)); n = i; if(i <= rowsSecOne){ // First Non-Inverted Pyramid Section for(j = i; j < rowsSecOne; ++j){ // j = 2; s+=' '; } for(k = 1; k <= l; ++k){ if(k <= m){ s+=n + ' '; n+=1; if(k === m){ n-=1; } } else { n-=1; s+=n + ' '; } } } else{ // Second Inverted Pyramid Section } console.log(s); s=''; l+=2; }
Editor Settings
Theme
Key bindings
Full width
Lines