Skip to content

Instantly share code, notes, and snippets.

@peat-psuwit
Created February 27, 2016 11:13
Show Gist options
  • Save peat-psuwit/bd8d3e29ad8624a20c79 to your computer and use it in GitHub Desktop.
Save peat-psuwit/bd8d3e29ad8624a20c79 to your computer and use it in GitHub Desktop.
#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