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); }
Comments
Leave a comment