Write a program to take input of two integer variable a and b. After taking input of these variables print all the palindrome numbers from a to b. I need this is C programming language.
#include <stdio.h> int main() { int a, b, i, num, reverse; printf("Enter first integer: "); scanf("%d", &a); printf("Enter second integer: "); scanf("%d", &b); printf("Palindromic numbers in the given range are\n"); for (i = a; i <= b; ++i) { num = i; reverse = 0; while (num > 0) { reverse *= 10; reverse += num % 10; num /= 10; } if (i == reverse) { printf("%d\n", i); } } return 0; }
Get Answers For Free
Most questions answered within 1 hours.