Advertisement
sellmmaahh

OR-2007-Izbaci Djeljive sa 3

Aug 10th, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int Izbaci (int n) {
  5.     if (n<0) return 0;
  6.     int cifra,k=1,nb=0;
  7.     while (n!=0) {
  8.             cifra=n%10;
  9.     if (cifra%3!=0) { nb+=cifra*k;
  10.      k*=10; }
  11.     n/=10;
  12.  
  13.     }
  14.     return nb;
  15. }
  16.  
  17. int main () {
  18.     printf("%d",Izbaci(13579));
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement