Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Да се напише рекурзивна функција која ќе го пресметува збирот на цифрите на
- еден број.
- #include <stdio.h>
- int zbir_cifri(int broj)
- {
- if(broj==0)
- {
- return 0;
- }
- else
- return broj%10+zbir_cifri(broj/10);
- }
- int main()
- {
- int n;
- scanf("%d",&n);
- printf("Zbirot na cifrite na %d e %d",n,zbir_cifri(n));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment