Josif_tepe

Untitled

Aug 13th, 2025
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.     int broj;
  5.     scanf("%d", &broj);
  6.    
  7.     int zbir = 0;
  8.     for(int i = broj; i > 0; i /= 10) {
  9.         int cifra = i % 10;
  10.        
  11.         zbir += cifra;
  12.         printf("%d ", cifra);
  13.     }
  14.     printf("\n%d\n", zbir);
  15.     return 0;
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment