add cycle automation

This commit is contained in:
Костя 2025-07-02 19:30:35 +03:00
parent 6428289c60
commit ef7410dd10
1 changed files with 24 additions and 10 deletions

View File

@ -23,20 +23,34 @@
// || - OR
// !
function SUMMA (chislo: number){
let result = chislo;
if (chislo / 3 == 1 || chislo / 3 == 2 || chislo / 3 == 3 || chislo / 5 == 1 ){ //условие если переменная chislo делиться на 3 или на 5 то вывод на экран
let array: number [] = [result]; //массив
console.log(array);
function SUMMA (chislo: number, chisloP: number){
let funcres = chislo;
//if (chislo / 3 == 1 || chislo / 3 == 2 || chislo / 3 == 3 || chislo / 3 == 4 || chislo / 5 == 1 ){ //пример кода статичный
if (chislo / 3 >=1 && chislo / 3 == chisloP ){ //условие если переменная chislo делиться на 3 или на 5 то вывод на экран
let array: number []= [funcres]; //массив
console.log(array);
}
}
}
for(let index = 1; index < 10; ){
SUMMA(index);
for(let index = 1; index < 10; ){
SUMMA(index, index - 2 );
index = index +1;
}
/*
console.log(`===================`)
const numbers = [funcres];
let sum = 0;
for (const num of numbers) {
sum += num;
}
console.log(sum); */
// Вывод: 15
//console.log(`summa of numbre <1000: ${result}`);