For tsiklidan foydalaniladigan natural sonlar yig'indisi
JavaScript
xxxxxxxxxx
const number = parseInt(prompt('Enter a positive integer: '));
let sum = 0;
for (let i = 1; i <= number; i++) {
sum += i;
}
console.log('The sum of natural numbers:', sum);
Enter a positive integer: 100 The sum of natural numbers: 5050
For tsiklidan foydalaniladigan natural sonlar yig'indisi
JavaScript
xxxxxxxxxx
const number = parseInt(prompt('Enter a positive integer: '));
let sum = 0, i = 1;
while(i <= number) {
sum += i;
i++;
}
console.log('The sum of natural numbers:', sum);
Enter a positive integer: 100 The sum of natural numbers: 5050
Linux - anc-api-tools qanday o'rnatiladi
Linux - curvedns qanday o'rnatiladi
Linux - zenmap qanday o'rnatiladi
Python - Raqamning ijobiy, salbiy yoki 0 ekanligini tekshiring
C - Butun sondagi raqamlar sonini sanash
C++ - Raqam tub yoki oddiy emasligini tekshiring
C - Dinamik xotira ajratish yordamida eng katta raqamni toping
C++ - Kabisa yilini tekshiring
Kotlin - Raqamni teskari aylantirish
JavaScript - Satr ma'lum belgilar bilan boshlanishi va tugashini tekshiring
Linux - zstd qanday o'rnatiladi
C++ - Qism va qoldiqni toping
Linux - xbitmaps qanday o'rnatiladi
Kotlin - Raqamni n o‘nlik kasrgacha yaxlitlash
Python - Excel (XLSX) fayllarini yozish
Java - Raqamni teskari aylantirish
Kotlin - Sonning faktorialini toping
Java - Piramida va naqsh yarating
We have been online since 2021 and 1 millions of people around the globe have visited our website since then
More visitors every month