C语言经典题目“空心倒三角形”代码.docVIP

  • 139
  • 0
  • 约小于1千字
  • 约 1页
  • 2020-04-29 发布于河北
  • 举报

C语言经典题目“空心倒三角形”代码.doc

空心的倒三角型 输入:输入三角形的高度(h = 0)。 输出:打印相应的空心倒三角形。图样参见测试用例。 程序: #includestdio.h #include math.h int main() { int i,j,h; scanf(%d,h); for (i=1;i=h;i++) { for(j=1;ji;j++) printf( ); if(i==1||i==h) { for(j=1;j=2*(h-i)+1;j++) printf(*); printf(\n); } else { printf(*); for(j=1;j=2*(h-i)-1;j++) printf( ); printf(*\n); } } return 0; }

文档评论(0)

1亿VIP精品文档

相关文档