Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- int main() {
- int broj;
- scanf("%d", &broj);
- int zbir = 0;
- int posledna_cifra;
- while(broj > 0) {
- posledna_cifra = broj % 10;
- zbir += posledna_cifra;
- broj /= 10;
- }
- printf("%d\n", zbir);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement