fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int rows;
  6. int cols;
  7. cout<<"enter the number of rows & columns: "<<endl;
  8. cin>>rows>>cols;
  9. cout<<"Rectangle pattern: "<<endl;
  10.  
  11. for(int i=0;i<rows;i++){
  12. for(int j=0;j<cols;j++){
  13. cout<<"* "<<" ";
  14. }
  15. cout<<endl;
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5300KB
stdin
4 4
stdout
enter the number of rows & columns: Rectangle pattern: 
*  *  *  *  
*  *  *  *  
*  *  *  *  
*  *  *  *