![]() The only logic it tasks is reversing the number that we want to check for palindrome. Basically you need to either test your compiler or not rely on it. ![]() Wikipedia says that C/C++ usually implements an arithmetic shift on signed values. Printf("%d is not a palindrome number",num) Ĭhecking a palindrome number in C is very easy. Are the shift operators (<<, >) arithmetic or logical in C According to K&R 2nd edition the results are implementation-dependent for right shifts of signed values.Reverse a given number and compare it with the original given value. If the number match, we will print the number is a palindrome if not we print its not a palindrome number. The following steps are the standard procedure to check for the Palindrome Number in C Programming. Then using a while loop we will try to reverse the entered number using % and other athematic operationĪt last, we will compare the reversed number with the entered number By default, all the 1-digit numbers are palindrome numbers.įirst, we will ask the user to enter a number ![]() For example, 16461 is a palindrome number if you reverse this number still, we get 16461. ![]() let's discuss the Palindrome Program in C.Ī palindrome number is a special number because it remains the same when its digit gets reversed. Here in this program, we will code to check whether an entered number is a palindrome number or not.
0 Comments
Leave a Reply. |