paranid5

дз 1

Feb 25th, 2021 (edited)
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.28 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6.     int n = 0;
  7.     int r = 0;
  8.     int t = 0;
  9.  
  10.     scanf("%d", &n);
  11.  
  12.     for (; n; n /= 10)
  13.     {
  14.         const int d = n % 10;
  15.         r += d != 1 ? d * (int)pow(10, t++) : 0;
  16.     }
  17.  
  18.     printf("%d", r);
  19.     return 0;
  20. }
  21.  
Add Comment
Please, Sign In to add comment