Skip to content

Instantly share code, notes, and snippets.

@kunpengku
Created May 23, 2013 00:29
Show Gist options
  • Save kunpengku/5631974 to your computer and use it in GitHub Desktop.
Save kunpengku/5631974 to your computer and use it in GitHub Desktop.
trigle
#include <stdio.h>
int main()
{
int num;
int i,j;
printf("请输入您想生成的三角形高度: ");
scanf("%d",&num);
for(i=1; i<=num; i++)
{
for(j=1; j<2*num; j++)
{
if(j>num-i&&j<num+i)
printf("%c",'*');
else
printf(" ");
}
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment