Initial commit
This commit is contained in:
commit
15c381aaae
19 changed files with 828 additions and 0 deletions
23
sum_of_digits.c
Normal file
23
sum_of_digits.c
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/*----------------------------------------------------------
|
||||
* HTBLA-Leonding / Class: <your class>
|
||||
* ---------------------------------------------------------
|
||||
* Title: Sum of Digits
|
||||
* Author: */ your name /*
|
||||
* ----------------------------------------------------------
|
||||
* Description:
|
||||
* Recursive and iterative implementation of an algorithm that calculates
|
||||
* the sum of the digits of a given positive integer.
|
||||
* ----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
Instructions:
|
||||
|
||||
Define a function sum_of_digits(n) that takes a positive integer `n` as input.
|
||||
The sum of digits can be calculated as n mod 10 + sum of digits of n / 10 as long as n is larger than ten.
|
||||
|
||||
*/
|
||||
|
||||
// TODO: the recursive implementation
|
||||
|
||||
// TODO: the iterative implementation
|
||||
Loading…
Add table
Add a link
Reference in a new issue