SHARE
TWEET

1.zad feb2018

a guest Jan 21st, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4.  
  5. int main()
  6. {
  7.     int x;
  8.     int tmp_x;
  9.     int cifra;
  10.     int zbir;
  11.     int br_cifara = 0;
  12.        
  13.  
  14.     while(scanf("%d", &x) == 1)
  15.     {
  16.         tmp_x = abs(x);
  17.  
  18.         br_cifara = (int)(log10(tmp_x) + 1);
  19.         zbir = 0;
  20.        
  21.         while(tmp_x != 0)
  22.         {
  23.             cifra = tmp_x % 10;
  24.             zbir = zbir + cifra;
  25.             tmp_x = tmp_x / 10;
  26.         }              
  27.        
  28.         if((br_cifara % 2 == 0) || (zbir % 2 == 0))
  29.         {
  30.                 printf("%d ", x);
  31.         }
  32.     }
  33.  
  34.     printf("\n");
  35.  
  36.  
  37.     return 0;
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top