计算各位数为5678且每位不同
#include <stdio.h>
void PRINT(long s)
{
FILE *out;
printf("s=%ld\n",s);
if((out=fopen("result.dat","w+"))!=NULL)
{ fprintf(out,"s=%ld",s);
fclose(out);
}
}
main()
{
/*考生在此设计程序*/
int s=0,i,a,b,c;
for(a=5;a<=8;a++)
for(b=5;b<=8;b++)
for(c=5;c<=8;c++)
if(a!=b && a!=c&& c!=b) s+=100*a+10*b+c;
PRINT(s);
}
本文来自博客园,作者:JackieDYH,转载请注明原文链接:https://www.cnblogs.com/JackieDYH/p/17635004.html