Created
February 27, 2016 11:13
-
-
Save peat-psuwit/bd8d3e29ad8624a20c79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
int input, tmp; | |
int reversedInput = 0; | |
printf("A number: "); | |
scanf("%d", &input); | |
tmp = input; | |
while (tmp != 0) { | |
reversedInput = (reversedInput * 10) + (tmp % 10); | |
tmp /= 10; | |
} | |
if (input == reversedInput) | |
printf("Yes\n"); | |
else | |
printf("No\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment