求出用数字0至9组成的没有重复数字的三位偶数,并以每行10个数输出这些数. 我的程序有个错误,求帮忙

求出用数字0至9组成的没有重复数字的三位偶数,并以每行10个数输出这些数. 我的程序有个错误,求帮忙
#include
int main ()
int a,b,c,i,n=0;
{
for(i=100;i
lynewu 1年前 已收到1个回答 举报

淡去红颜 幼苗

共回答了15个问题采纳率:73.3% 举报

应该是
a=i/100;
b=(i/10)%10;
c=i%10;
然后 for(a!=b&&b!=c) 改成 if(a!=b&&b!=c)

1年前 追问

2

lynewu 举报

--------------------Configuration: 123 - Win32 Debug-------------------- Compiling... 123.cpp G:123123.cpp(3) : warning C4518: 'int ' : storage-class or type specifier(s) unexpected here; ignored G:123123.cpp(3) : error C2146: syntax error : missing ';' before identifier 'a' G:123123.cpp(3) : fatal error C1004: unexpected end of file found 我改完了,调试还是有一个错误,看不懂啊

举报 淡去红颜

#include int main () { int a,b,c,i,n=0; for(i=100;i<=998;i=i+2) { a=i/100; b=(i/10)%10; c=i%10; if(a!=b&&b!=c) { printf("%6d",i); n++; if(n%10==0) printf("n"); } } } 这样就没问题了
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 17 q. 0.018 s. - webmaster@yulucn.com