セクション 2. 章 3
single
Challenge: Cumulative Sum
メニューを表示するにはスワイプしてください
タスク
スワイプしてコーディングを開始
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
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください