求10到10000有哪些回文数?用C语言编写 并且用数组

来源:百度知道 编辑:UC知道 时间:2024/06/17 20:39:50
一定要用C语言哟!!不要C++

改成c语言了,再试试:
#include<stdio.h>
#include<vector>
using namespace std;
void main()
{
int num,temp1,temp2,count1=0,count2=0;
vector<int>test;
for(num=10;num<=10000;num++) //找10-10000的回文数
{
if(num<100)
{
temp1=num%10;
temp2=num/10;
if(temp1==temp2)
{
//cout<<num<<" ";
printf("%d ",num);
count1++;
if(count1>=10)//十个一行输出
{
printf("\n");
count1=0;
}
}
if(num==99)
printf("\n");
}
else{
temp1=num%10;
temp2=num/100;
if(temp1==temp2)
{
printf("%d ",num);
count2++;
if(count2>=10)
{
printf("\n");
count2=0;
}
}
}
}
}

#include "stdio.h"

int main()
{

long num;
long temp;
long mid;