Advertisement
Guest User

Untitled

a guest
May 28th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int num, temp, run, i = 0, k, ara[10], t, count = 0;
  6. scanf("%d\n",&run);
  7. for(k = 0; k < run; k++)
  8. {
  9. scanf("%d",&num);
  10. temp = num;
  11. while(temp != 0)
  12. {
  13. count++;
  14. t = temp % 10;
  15. ara[i] = t;
  16. i++;
  17. temp = temp / 10;
  18. }
  19. for(i = count - 1; i >= 0; i--)
  20. {
  21. if(ara[i] % 2 == 0) {
  22. ara[i] = ara[i] + 1;
  23. }
  24. else {
  25. ara[i] = ara[i] - 1;
  26. }
  27. }
  28. for(i = count - 1; i >= 0; i--) {
  29. printf("%d",ara[i]);
  30. }
  31. printf("\n");
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement