Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int num, temp, run, i = 0, k, ara[10], t, count = 0;
- scanf("%d\n",&run);
- for(k = 0; k < run; k++)
- {
- scanf("%d",&num);
- temp = num;
- while(temp != 0)
- {
- count++;
- t = temp % 10;
- ara[i] = t;
- i++;
- temp = temp / 10;
- }
- for(i = count - 1; i >= 0; i--)
- {
- if(ara[i] % 2 == 0) {
- ara[i] = ara[i] + 1;
- }
- else {
- ara[i] = ara[i] - 1;
- }
- }
- for(i = count - 1; i >= 0; i--) {
- printf("%d",ara[i]);
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement