diff --git a/C/program-50/Readme.md b/C/program-50/Readme.md new file mode 100644 index 00000000..06f7c7e1 --- /dev/null +++ b/C/program-50/Readme.md @@ -0,0 +1,13 @@ +Program 50 + +Write a program to check whether a given number is a palindrome or not. + +Variable description-- + +n=Holds the element which is to be checked + +temp=Holds the copy of the element + +rev= Holds the reverse of the number + +rem=Holds the digits of the number diff --git a/C/program-50/program.c b/C/program-50/program.c new file mode 100644 index 00000000..0bd7302c --- /dev/null +++ b/C/program-50/program.c @@ -0,0 +1,19 @@ +#include +int main() +{ + int rem,rev=0,temp,n; + printf("Enter the number"); + scanf("%d",&n); + temp=n; + while(n>0) + { + rem=n%10; + n=n/10; + rev=rem+(rev*10); + } + if(temp==rev) + printf("number is palindrome"); + else + printf("number is not palindrome"); + return 0; +}