Advertisement
Josif_tepe

Untitled

Aug 21st, 2023
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main(int argc, const char * argv[]) {
  4.    
  5.     int a, b;
  6.     scanf("%d%d", &a, &b);
  7.    
  8.     for(int i = a; i <= b; i++) {
  9.         int pom = i;
  10.         int zbir = 0;
  11.         while(pom > 0) {
  12.             int cifra = pom % 10;
  13.             zbir += cifra;
  14.             pom /= 10;
  15.         }
  16.         printf("%d ", zbir);
  17.     }
  18.     return 0;
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement