728 B
728 B
author | date | institution | subtitle | title | geometry | numbersections | secnumdepth | ||||
---|---|---|---|---|---|---|---|---|---|---|---|
Julia Spriggs | 15 Octobre 2024 | Wild Code School | Documenting Stuff | My Title |
|
true | 2 |
\newpage
lol
test
list:
- one
- subone
- two
// program to find the sum of natural numbers using recursion
function sum(num) {
if(num > 0) {
return num + sum(num - 1);
}
else {
return num;
}
}
// take input from the user
const number = parseInt(prompt('Enter a positive integer: '));
const result = sum(number);
// display the result
console.log(`The sum is ${result}`);
\newpage
follow
new bla
image: