正确的输出格式
count没有初始化
确实与count的初值有关,应该赋零值
#include <stdio.h>
int main()
{
int i,j,count=0;
for(i=1;i<=100;i++)
{
if(i%7==0)
{
printf("%3d",i);
count++;
if(count%6==0)//if语句后面只执行一句时是可以不加中括号的
printf("\n");}
else{
j=i;
while(j>0){
if(j%10==7){
printf("%3d",i);
count++;
if(count%6==0)
printf("\n");}
j=j/10;}
}
}
return 0;}