c语言图形

来源:百度知道 编辑:UC知道 时间:2024/05/26 13:23:49
*
***
*****
*******
怎么编程??
*
1***
11*****
111*******
当中的1是空格 ,因提问空格打不出来,用1代替~~~

#include "stdio.h"
main()
{
int j,i;
for(j=0;j<4;j++)
{
for(i=0;i<j;i++)
printf(" ");
for(i=1;i<=1+2*j;i++)
printf("*");
printf("\n");
}
}

通过编译 输出结果:
*
1***
11*****
111*******

#include <stdio.h>
#include <conio.h>
int main()
{
int i,j,n;
int y;
scanf("%d",&n);
y=wherey();
for(i=0;i<n;i++)
{
gotoxy(i+1,y+i);
for(j=2*i+1;j;j--) printf("*");
}
getch();
}

#include <stdio.h>
void main()
{
printf("*\n");
printf("***\n");
printf("*****\n");
printf("*******\n");
}