Advertisement
Alx09

Untitled

May 4th, 2020
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int st1[100], st2[100], n,varf1, varf2;
  5. void Punctul_1() {
  6. scanf("%d", &n);
  7. while (n) {
  8. st1[++varf1] = n % 8;
  9. n /= 8;
  10. }
  11.  
  12. }
  13. void Punctul_2() {
  14. int i;
  15. for (i = 1; i <= varf1; varf1++)
  16. if ((st1[i] & (st1[i] - 1)) != 0)
  17. st2[++varf2] =st1[i];
  18. }
  19. void Punctul_3() {
  20. int i;
  21. for (i = varf2; i; i--)
  22. if ((st2[i] & 1) && (st2[i] & 4))
  23. printf("%d\n", st2[i]);
  24.  
  25. }
  26.  
  27. int main() {
  28. Punctul_1();
  29. Punctul_2();
  30. Punctul_3();
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement