计算各位数为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);
}

 

posted @ 2019-09-27 09:17  JackieDYH  阅读(7)  评论(0编辑  收藏  举报  来源