Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. int main()
  6. {
  7. int number = 0,sum = 0,another = 0,calc = 0;
  8. scanf("%d",&number);
  9.  
  10. while (number > 0)
  11. {
  12. sum = 0;
  13. another = number;
  14. while (another > 0)
  15. {
  16. sum += another % 10;
  17. another /= 10;
  18. }
  19. number -= sum;
  20. ++calc;
  21. }
  22.  
  23. printf("%d",calc);
  24. getchar();
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement