蓝桥杯基础 算法训练 图形显示 (简单模拟,坑)

问题描述

  编写一个程序,首先输入一个整数,例如5,然后在屏幕上显示如下的图形(5表示行数):
  * * * * *
  * * * *
  * * *
  * *
  *

垃圾题目,又不说清楚,n==0的时候要结束才行,不然超时。 

#include<iostream>
using namespace std;

int main()
{
	int n,m,j,k,i,T;
	scanf("%d",&n);
	if (n<=0)
	return 0;
		while (n--)
		{
			for (i=0;i<=n;i++)
			{
				 printf("*");
				 if (i!=n)
				 printf(" ");
			}
			printf("\n");
		}
	
	
	return 0;
}

 

posted @ 2019-02-07 20:18  RomanticChopin  阅读(102)  评论(0编辑  收藏  举报
-->
Live2D