This program will print list of palindrome numbers between given range.
// C Program to Generate palindrome numbers in a given range of numbers.
#include<stdio.h>
int main(){ int i, start, end, rem, rev_num, temp; printf("Enter first number (lower limit): "); scanf("%d",&start); printf("Enter last number (upper limit): "); scanf("%d",&end); printf("List of Palindrome numbers between %d - %d: ",start, end); for(i=start; i<=end; i++) { temp = i; rev_num=0; while(temp){ rem = temp%10; temp = temp/10; rev_num = rev_num*10 + rem; } if(i == rev_num) printf("%d ", i); } return 0; }
Output of program
Enter first number (lower limit): 80 Enter last number (upper limit): 150 List of Palindrome numbers between 70 - 200: 88 99 101 111 121 131 141
No comments:
Post a Comment