Statistica
                        MATLAB Answers
                        
                    0 Domande
                        1 Risposta
RANK
74.652
                          
                          
of 300.381
                        
REPUTAZIONE
0
                           
                        
CONTRIBUTI
                          0 Domande
                          1 Risposta
ACCETTAZIONE DELLE RISPOSTE 
                            0.00%
                        
VOTI RICEVUTI
0
RANK
of 168.477
CONTRIBUTI
                            0 Problemi
                            0 Soluzioni
PUNTEGGIO
0
NUMERO DI BADGE
0
CONTRIBUTI
0 Post
CONTRIBUTI
0 Pubblico Canali
VALUTAZIONE MEDIA
CONTRIBUTI
0 Punti principali
NUMERO MEDIO DI LIKE
Feeds
Risposto
I want to write a recursive Function that can calculate the sum of all the digit. If the input is 12345 then the answer will be 1+2+3+4+5 , without using string2num and loop.
function x=digit_sum(inp) if inp<10 x=inp; else x = mod(inp,10) + digit_sum(fix(inp/10)); end ...
    
  
I want to write a recursive Function that can calculate the sum of all the digit. If the input is 12345 then the answer will be 1+2+3+4+5 , without using string2num and loop.
function x=digit_sum(inp) if inp<10 x=inp; else x = mod(inp,10) + digit_sum(fix(inp/10)); end ...
circa 5 anni fa | 0
