velimir

Zadaca2Ani

Oct 31st, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. /*
  2. zadaca 2.
  3. input:
  4. 7
  5. 2 42 4 16 96 101 202
  6. output:
  7. 42 16 96 202
  8. */
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11.  
  12. int func(int a){
  13.     int i, x, x1, counter=0;
  14.     for(i=0; i<a; i++){
  15.         x1 = x;
  16.         scanf("%d", &x);
  17.         if(i==0){
  18.             continue;
  19.         }
  20.         if(x%x1==0){
  21.             printf("%d ", x);
  22.             counter++;
  23.         }
  24.     }
  25.     return counter;
  26. }
  27.  
  28. int main()
  29. {
  30.     int i, br1, br2, n, coutie=0;
  31.     scanf("%d", &n);
  32.     printf("\n%d",func(n));
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment