On Fri 2009-03-06 06:12:38 UTC-0000, ruhatadiyaman ([email protected])
wrote:
> but before it there was another exercise which
> wants the code of finding the palindrome( from book: a palindrome is a
> number or a text phrase that reads the same backwards as
> forwards.ex:12321, 34643...write a program that reads in a five digit
> integer and determines whether or not it is a palindrome.) i wrote
> this code for this question;
> /*palindrome*/
> #include<stdio.h>
>
> int main()
> {
> int sayi, a, b, c, d, e, sayi2, end;
> printf("sayi gir : ");
> scanf("%d", &sayi);
> /*seperate the number into digits*/
> a=sayi/10000;
> b=(sayi%10000)/1000;
> c=(sayi%(10000*a+1000*b))/100;
...
That seems awfully complicated. Why not read in a string, make a
copy, reverse the copy, then compare it to the original?