From 3cea580709d57a659549e8761b86136536e82854 Mon Sep 17 00:00:00 2001 From: adityaa1510 <56119283+adityaa1510@users.noreply.github.com> Date: Sat, 10 Oct 2020 22:55:24 +0530 Subject: [PATCH] Create PALLIDROME --- PALLIDROME | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 PALLIDROME diff --git a/PALLIDROME b/PALLIDROME new file mode 100644 index 0000000..683bdd8 --- /dev/null +++ b/PALLIDROME @@ -0,0 +1,28 @@ +#include +int main() +{ + int num, reverse_num=0, remainder,temp; + printf("Enter an integer: "); + scanf("%d", &num); + + /* Here we are generating a new number (reverse_num) + * by reversing the digits of original input number + */ + temp=num; + while(temp!=0) + { + remainder=temp%10; + reverse_num=reverse_num*10+remainder; + temp/=10; + } + + /* If the original input number (num) is equal to + * to its reverse (reverse_num) then its palindrome + * else it is not. + */ + if(reverse_num==num) + printf("%d is a palindrome number",num); + else + printf("%d is not a palindrome number",num); + return 0; +}