From a60410b95773b8055e59d86251a98378703fe409 Mon Sep 17 00:00:00 2001 From: Ulyana Date: Sun, 8 Oct 2023 22:01:44 +0300 Subject: [PATCH] numver 3 done --- main.js | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/main.js b/main.js index 4451102..e74c51a 100644 --- a/main.js +++ b/main.js @@ -73,21 +73,18 @@ console.log(sum3); for(let x = 1; x <= 9; x++) { console.log('7' + ' ' + 'x' + ' ' + x + ' ' + '=' + ' ' + 7 * x); } - // 3.3 !!!!!!!!!????????????? -//const numberN = +prompt("Enter a number: "); -//for(let y = 1; y <= numberN; y++) { -// if(y % 2 != 0) { -// let yOdd = y; -// -// } -// let sum = 0; -// sumOdd = sum + yOdd; -// console.log(sumOdd); -//} -//let Odd = 1; -//while(Odd <= numberN && Odd % 2 != 0) { -// console.log(Odd); -//} + // 3.3 +const numberN = +prompt("Enter an N number: "); +let count = 0; +let summ = 0; +for(let y = 1; y <= numberN; y++) { + if(y % 2 != 0) { + count += 1; + summ += y ; + } +} +const itog = summ / count; +console.log(itog); // HW 4 let user = {