C语言编程难题,跪求大神解答
展开全部
int o, n, e;
int sum = 0;
for (o = 0; o <= 9; o++) {
for (n = 0; n <= 9; n++) {
if (n == o)continue;
for (e = 0; e <= 9; e++) {
if (e == n)continue;
int temp1 = o * 100 + n * 10 + e;
int temp = temp1 + temp1;
int w = temp / 10 % 10;
int t = temp / 100;
int ot = temp % 10;
if ((t<=9)&&(w != t) && (w != o) && (o == ot)) {
sum++;
printf("%3d+%3d=%3d\n", temp1, temp1, temp);
}
}
}
}
printf("总计:%d", sum);
展开全部
int o, n, e;int sum = 0;for (o = 2; o <=4; o++2) { for (n = 0; n <= 9; n++) { if (n == o)continue; for (e = 1; e <= 9; e++) { if (e == n)continue; int temp = o * 200 + n *20 +2* e; int w = temp / 10 % 10; int t = temp / 100; int ot = temp % 10; if ((o == ot)&& (t<=9)&&(w != t) && (w != o) && (w != n)&& (w != e)&&(t != o) && (t != n)&& (t!= e)) { sum++; printf("%3d+%3d=%3d\n", temp/2, temp/2, temp); } } }} printf("总计:%d", sum);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询