2183 - 打印字符图样
根据输入(N,M)输出N行M列的字符图样,如下图所示N=4, M=6
**
**
**
**
题目输入
输入只有一对正整数N,M。
题目输出
输出N行M列星形图
输入/输出样例
题目输入
4 6
题目输出
****** ****** ****** ******
C++解答
#include <iostream> using namespace std; int main(){ int n,m; cin>>n>>m; for(int i =1;i<=n;i++){ for(int j=0;j<i-1;j++){ cout<<" "; } for(int k =1;k<=m;k++){ cout<<'*'; } cout<<endl; } return 0; }