Challenge: Cumulative Sum
Завдання
Swipe to start coding
Write a function that calculates the cumulative sum of all integers from 1 up to a given positive integer n using a for loop.
- Define a function named
cumulativeSumthat takes an integernas its parameter; - Use a for loop to add all numbers from 1 to
nand store the result; - Return the final sum from the function;
- Do not use any library functions for summation; implement the logic using a for loop only.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 2. Розділ 3
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Чудово!
Completion показник покращився до 9.09
Challenge: Cumulative Sum
Свайпніть щоб показати меню
Завдання
Swipe to start coding
Write a function that calculates the cumulative sum of all integers from 1 up to a given positive integer n using a for loop.
- Define a function named
cumulativeSumthat takes an integernas its parameter; - Use a for loop to add all numbers from 1 to
nand store the result; - Return the final sum from the function;
- Do not use any library functions for summation; implement the logic using a for loop only.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 2. Розділ 3
single