C Palindrome Program, C Program For Palindrome - Programming Simplified
C Palindrome Program, C Program For Palindrome - Programming Simplified
http://www.programmingsimplified.com/c-program-find-palindrome
Palindrome number in c
#include <stdio.h> main() { int n, reverse = 0, temp; printf("Enter a number to check if it is a palindrome or not\n"); scanf("%d",&n); temp = n; while( temp != 0 ) { reverse = reverse * 10; reverse = reverse + temp%10; temp = temp/10; }
1 of 4
12/24/2012 5:42 PM
http://www.programmingsimplified.com/c-program-find-palindrome
if ( n == reverse ) printf("%d is a palindrome number.\n", n); else printf("%d is not a palindrome number.\n", n); return 0; }
2 of 4
12/24/2012 5:42 PM
http://www.programmingsimplified.com/c-program-find-palindrome
int string_length(char *string) { int length = 0; while(*string) { length++; string++; } return length; } void copy_string(char *target, char *source) { while(*source) { *target = *source; source++; target++; } *target = '\0'; } void reverse_string(char *string) { int length, c; char *begin, *end, temp; length = string_length(string); begin = string; end = string; for ( c = 0 ; c < ( length - 1 ) ; c++ ) end++; for ( c = { temp = *end = *begin 0 ; c < length/2 ; c++ ) *end; *begin; = temp;
begin++; end--; } } int compare_string(char *first, char *second) { while(*first==*second) { if ( *first == '\0' || *second == '\0' ) break; first++; second++; } if( *first == '\0' && *second == '\0' ) return 0; else return -1; }
awesome
awesome man! you really rock.
reply
excellent
3 of 4
12/24/2012 5:42 PM
http://www.programmingsimplified.com/c-program-find-palindrome
excellent
reply
One Request
Please post the same program without using library function.
reply
adminPs
Mon, 22/08/2011 - 10:16 permalink
Code added
Required c code is added to content.
reply
palindrome program in c
Thanks for palindrome program in c language to check number and string as a palindrome.
reply
c palindrome code
Thanks a lot!
reply
4 of 4
12/24/2012 5:42 PM