Question #54259

Write a program that will display the following pattern, given the value of n and m.
Example : if n=4, and m=3, output.
****
****
****

Expert's answer

#include <iostream>
using namespace std;
int main(){
int n,m;
cout<<"Please input n = ";
cin>>n;
cout<<"Please input m = ";
cin>>m;
int j=1;
do{
for(int i=1;i<=n;i++)
{
cout<<"*";
if (i%n==0) cout<<endl;
}
j++;
}while(j<=m);
}
LATEST TUTORIALS
APPROVED BY CLIENTS