Advertisement
add1ctus

Мали цифри

Jan 29th, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int pomali_od_5(int n)
  4. {
  5.     if(n==0)
  6.         return 0;
  7.     if(n%10<5)
  8.         return pomali_od_5(n/10)*10+n%10;
  9.     return pomali_od_5(n/10);
  10. }
  11.  
  12. int main()
  13. {
  14.     int a,n;
  15.     scanf("%d",&n);
  16.     for( ; n>0 ; n--)
  17.     {
  18.         scanf("%d",&a);
  19.         printf(" : %d\n",printf("%d",pomali_od_5(a)));
  20.     }
  21.  
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement