C语言,配数问题

来源:百度知道 编辑:UC知道 时间:2024/05/24 04:10:30
a b c + c b = b c a ,给其中的abc配数,用一重for循环,记得是一重哦.好心的大哥大姐帮个忙,小子感激不尽...
不要答非所问啊...那配数的意思就是给他们招几个数字配上,然后满足那式子....

int search()
{
int x=y=z=0;
for(int i=100;i<999;i++)
{
x=i;
y=(i%100)*10+(i%10)/10;
z=(int)((i%10)/10)*100+(i%100)*10+i/100;
if((x+y)==z)
return x;
}
return 0;
}

#include <stdlib.h>
#include <stdio.h>

int main(){

int ge,shi,bai,i;

for(i=100;i<1000;i++){
bai=(int)i/100;
shi=(int)(i-(bai*100))/10;
ge=i-bai*100-shi*10;

if(i+ge*10+shi==shi*100+ge*10+bai)
printf("\nnum:%d",i);
}

getch();
return 0;
}