+ 2

Why it is not showing output?

#include <stdio.h> int ispalindrome(int number){ int p,rem,rev=0; p= number ; while(number !=0){ rem = number % 10; rev = rev*10+rem; number /= 10; number++; } printf ("%d\n",rev); if(p == rev){ printf ("The number you have entered %d is a palindrome number!!\n",number ); return 1; } else{ printf ("The number you have entered %d is not a palindrome number!!\n",number ); return 0; } } int main() { int num; printf("Enter a number for check, it is palindrome or not\n"); scanf("%d",&num); ispalindrome (num); return 0; }

17th Aug 2020, 8:13 PM
Rupali Haldiya
Rupali Haldiya - avatar
2 Answers
0
You wrote number++; (remove it), in while so it become 1 at least and while condition number! =0, never fail, always try so it is infinite loop.... Remove that line.. And print 'p' instead of 'number'..
17th Aug 2020, 8:27 PM
Jayakrishna 🇼🇳
+ 1
Thanku maam, it is working now!!
18th Aug 2020, 8:13 AM
Rupali Haldiya
Rupali Haldiya - avatar