Advertisement
Guest User

Untitled

a guest
May 26th, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.81 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void feltolt(int*);
  5. void masolas(int*, int*);
  6.  
  7.  
  8. int main()
  9. {
  10.     int tomb[300];
  11.     int masodiktomb[300];
  12.  
  13.     feltolt(&tomb);
  14.     masolas(&tomb, &masodiktomb);
  15.  
  16.     return 0;
  17. }
  18.  
  19.  
  20. void feltolt(int* tombpointer)
  21. {
  22.     int i = 0;
  23.     int j;
  24.  
  25.     for(j = 1000; j < 10000; j++)
  26.     {
  27.         if( (j & (1 << 1)) && (j & (1 << 2)) && !(j & (1 << 3)) )
  28.         {
  29.             tombpointer[i] = j;
  30.             i++;
  31.             if(i == 300)
  32.             {
  33.                 break;
  34.             }
  35.         }
  36.     }
  37. }
  38.  
  39. void masolas(int* tombpointer, int* tombpointer2)
  40. {
  41.     int i;
  42.     int j = 0;
  43.  
  44.     for(i = 0; i < 300; i++)
  45.     {
  46.         if(tombpointer[i] % 3 == 0)
  47.         {
  48.             tombpointer2[j] = tombpointer[i];
  49.             j++;
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement