Advertisement
Guest User

Untitled

a guest
Mar 28th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. using System;
  2.  
  3. class Love
  4. {
  5. static void Main()
  6. {
  7. int n = int.Parse(Console.ReadLine());
  8. int[] numbers = new int[n];
  9. int[] result = new int[n];
  10.  
  11. for (int i = 0; i < n; i++)
  12. {
  13. numbers[i] = int.Parse(Console.ReadLine());
  14.  
  15. result[i] = 0;
  16. while (numbers[i] > 0)
  17. {
  18. result[i] <<= 1;
  19. if ((numbers[i] & 1) != 0)
  20. result[i] |= 1;
  21. numbers[i] >>= 1;
  22. }
  23. }
  24.  
  25. for (int i = 0; i < n; i++)
  26. {
  27. Console.WriteLine(result[i]);
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement