#include<stdio.h> int main(){ int num, rem, reverse_num, temp, start, end; printf("Enter the lower limit: "); scanf("%d",&start); printf("Enter the upper limit: "); scanf("%d",&end); printf("Palindrome numbers between %d and %d are: ",start,end); for(num=start;num<=end;num++){ temp=num; reverse_num=0; while(temp){ rem=temp%10; temp=temp/10; reverse_num=reverse_num*10+rem; } if(num==reverse_num) printf("%d ",num); } return 0; }
结果
Enter the lower limit: 12
Enter the upper limit: 128
Palindrome numbers between 12 and 128 are: 22 33 44 55 66 77 88 99 101 111 121
Process returned 0 (0x0) execution time : 18.003 s
Press any key to continue.
除教程外,本网站大部分文章来自互联网,如果有内容冒犯到你,请联系我们删除!