Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
So in this challenge, what we are going to do is to write the recursive function that first of all,
what it will do is receive a number NUM.
And once it receives these num, all the recursive function task is to find out and return the sum of
all digits.
In this particular number.
So we simply take a given number.
It may of one digit two digits, three digit digits and so on.
And all these function has to do is to find out what will be the sum of all the digits.
So, for example, if we take NUM as 67, then we know that the sum of all of its digits will be six
plus seven, which is a total of 13.
Okay.
And the function, once it's found out, are all the sum of the digits.
The function simply should return 13.
In this example, any a for another example, we have NUM like nine thousand five hundred thirty one.
So the sum of digits is going to be pretty much calculated in the same way.
Right.
Because we use some recursive calls.
We divided to solve problems.
And it doesn't matter for us how many digits there will be in a given number as long as we know the
formula to how to divide it, to solve problems and make our recursive calls.
So in this case, if we want to know that some of these just we will simply sum up nine plus five plus
three plus one, which give us a total off of what it will be, the total of 18.
So that's pretty much the exercise.
We have to write the recursive function.
I know it's kind of tempting to use just thing for a loop to find out what will be the result.
Right.
Because we can use for a loop, so why wouldn't we use it?
Something that we know.
And the reason is very simple, because our task is to practice some recursive approach to find out
how can we divide, to solve problems are some bigger problem, and then to reach some base condition
or a stopping condition and to build up all our way up to find Venus the necessary result.
So take your time, guys.
Think about the solution.
Try to understand what will be the base case.
What will be the recursive calls?
And make me write also the the main function that will check out and makes sure that the recursive function
works as expected.
And then, of course, we are going to solve this exercise together.
So I'll see you there.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.