Writing a C Program to Print Available Palindrome Numbers between 50 to 100 using a While Loop
Program to Print Available Palindrome Numbers Between 50 to 100 Using a While Loop
A palindrome is a number which is same when read forward and backward. For example, 77, 88
and 121
are palindrome numbers.
In this program, we will print all available palindrome numbers between 50
to 100
using a while loop.
C Program to Print Available Palindrome Numbers Between 50 to 100 Using a While Loop
#include
int main()
{
int n, reversedInteger = 0, remainder, originalInteger;
printf("\n Palindrome numbers from 50 to 100 are: \n");
// Loop from 50 to 100
n=50;
while(n<=100)
{
originalInteger = n;
// Reverse the number
while(originalInteger != 0)
{
remainder = originalInteger%10;
reversedInteger = reversedInteger*10 + remainder;
originalInteger /= 10;
}
// Check if reverse of number and original number are same
if(reversedInteger==n)
printf("%d\n",n);
// Reverse the number again for further loop iterations
reversedInteger=0;
n++;
}
return 0;
}
Output:
Palindrome Numbers from 50 to 100 are: 55 66 77 88 99
Further Reading:
Program to check whether the given string is a palindrome or not in c
write a program to print palindrome numbers in 10 array elements.
Palindrome number in c programming
Write a c program for 10 elements palindrome number
Design a function to check the given number is Palindrome or not if Palindrome return 1 else 0
Writing a C Program to Print Available Palindrome Numbers between 50 to 100 using a While Loop
Enroll Now:
[ C-Programming From Scratch to Advanced 2023-2024] "Start Supercharging Your Productivity!"
Contact Us:
- For any inquiries, please email us at [info@electro4u.net].
- Follow us on insta [ electro4u_offical_ ] for updates and tips.
Note: If you encounter any issues or specific errors when running this program, please let me know and I'll be happy to help debug them!