请求帮助,谢谢
输出图形 *
* *
* * *
* * * *
* * * * *
* * * * * *
分别用for,while,do...while实现,请求帮助,谢谢
程序代码:#include <stdio.h>
#include <string.h>
int main()
{
char i=1,temp=0, number=0;
char *str=" "; //35个空格符
printf("Please input a value ( 1<value<35 ):");
scanf("%d",&number);
str+=strlen(str)-number; //根据输入的数据自动调整图形的位置,确保图形进靠左边,此句也可删除。
while(i<number+1)
{
temp=i;
printf("%s",str+i);
while(temp>0)
{
printf("%2c",'*');
temp-=1;
}
printf("\n");
i++;
}
printf("\n");
return 0;
}

程序代码:#include <stdio.h>
#include <string.h>
int main()
{
char i=1, number=0;
char *str=" "; //35个空格符
char *p="* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "; //35个'*'
printf("Please a value ( 1<value<35 ):");
scanf("%d",&number);
str+=strlen(str)-number;
while(i<number+1)
{
printf("%s",str+i);
printf("%s\n",p+(strlen(p)-i*2));
i++;
}
printf("\n");
return 0;
}
