69,382
社区成员
发帖
与我相关
我的任务
分享
/*
目的:输入数据,打印输出连续的*号
*/
#include <stdio.h>
int main()
{
int x;
printf("Enter data(-1 to end):");
scanf("%d",&x);
int i=1;
while(x!=-1)
{
for(;i<=x;++i)
{
printf("*");
}
printf("\n");
if(x==-1)
break;
printf("Enter data(-1 to end):");
scanf("%d",&x);
}
printf("\n");
return 0;
}
/*
目的:输入数据,打印输出连续的*号
*/
#include <stdio.h>
int main()
{
int x;
printf("Enter data(-1 to end):");
scanf("%d",&x);
int i;
while(x!=-1)
{
for(i = 1 ;i<=x;++i)//将i=1放在这里。。
{
printf("*");
}
printf("\n");
if(x==-1)
break;
printf("Enter data(-1 to end):");
scanf("%d",&x);
}
printf("\n");
return 0;
}