试题 算法训练 图形显示


资源限制
时间限制:1.0s 内存限制:512.0MB
问题描述
  编写一个程序,首先输入一个整数,例如5,然后在屏幕上显示如下的图形(5表示行数):




  * *
  *

这里要注意最后一行,以及*中间有空格

#include<iostream>
using namespace std;

int main(){
int a;
cin>>a;
for(int i=0;i<a;i++){
for(int j=a-i;j>0;j--){
cout<<"* ";
}
if(i!=a-1){
cout<<endl;
}
}
return 0;
}