Answer to Question #54259 in C++ for Ric

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.
****
****
****
1
Expert's answer
2015-08-27T02:40:01-0400
#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);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS