C语言竖式问题

#include<stdio.h>
#include<string.h>
int main(){
char str[30];//键盘输入数组
scanf("%s",str);
int i,j;
char sta[50];//字符串输入输出数组
int count=0; 
for(i=1000;i<=9999;i++){
for(j=10;i<=99;i++){
int pro=i*j;
int pro1=i*(j%10);
int pro2=i*(j/10);
sprintf(sta,"%d%d%d%d%d",i,j,pro1,pro2,pro);
int cas=1;
int m;
for(m=0;m<strlen(sta);m++)
if(strchr(str,sta[m])==NULL)
cas=0;
if(cas){
count++;
printf("<-%d->\n",count);
printf("%5d\nX%4d\n-----\n%5d\n%-4d\n-----%6d\n",i,j,pro1,pro2,pro);
}
}
} 
printf("The num of solutions=%d\n",count);
return 0; 
}

当我输入2357时,原本应该有775*33=25575的相关输出,结果显示解有0个。

错在哪里?

化糖
浏览 2632回答 3
3回答

___C___

你好,有两处手误一:第9行:for(i=1000;i<=9999;i++){改正:for(i=100;i<=999;i++){二:第10行:for(j=10;i<=99;i++){改正:for(j=10;j<=99;j++){谢谢采纳
打开App,查看更多内容
随时随地看视频慕课网APP