c语言 找出两位数ab,使其满足ab*ba=736

来源:百度知道 编辑:UC知道 时间:2024/09/19 20:42:29
如下哪里错了

#include <stdio.h>
void main()
{
int x,y,c1,c1,c;
for(c=12;c<99;c++)
{
c1=c/10;
c2=c%10;
x=10*c1+c2;
y=10*c2+c1;
if (736==x*y)
printf("%d",c);
}
printf("\n");
}

定义变量的时候,出了两个C1肯定不对,并且应该是x*y==736

c1定义成INT 有问题

#include <stdio.h>
void main()
{
int x,y,c1,c2,c3;
clrscr();
printf("print ab*ba =736\n");
for(c3=10;c3<100;c3++)
{
c1 =c3/10;
c2 =c3%10;
x=10*c1+c2;
y=10*c2+c1;
if(x*y == 736)
{
printf("%d",c3);
printf("\n");
}
}
}
---
23
32