Deitel & Deitel, C How to Program 6th Edition, Exercise 3.35



#include <stdio.h>

int main() {

int a, a1, a2, a3, a4, a5, remain;
printf("Enter number: ");
scanf("%d", &a);
a1 = a / 10000;
remain = a % 10000;
a2 = remain / 1000;
remain %= 1000;
a3 = remain / 100;
remain %= 100;
a4 = remain / 10;
a5 = remain % 10;
if (a1 == a5 && a2 == a4)
printf("palindrome\n");
else
printf("nope\n");

return 0;
}

Comments

Popular posts from this blog

Deitel & Deitel, C How to Program 6th Edition, Exercise 6.23 (Turtle Graphics)

Deitel & Deitel, C How to Program 6th Edition, Exercise 6.22 (Total Sales)

Deitel & Deitel, C How to Program 6th Edition, Exercise 5.47 (Craps Game Modification)