Home C C++ Java Python Perl PHP SQL JavaScript Linux Online Test Forum

Home » Forum » x-Forum » Question

Develop a program that will display a rectangle of *

Example :     5
Columns:      7


      *******
      *******
      *******
      *******
      *******

Posted by uehara123 2019-01-24 03:38:10

#include<iostream>
using namespace std;

int main(){
int rows, cols;

cout<<"
 Enter number of rows : "; 
cin>>rows;
cout<<"
 Enter number of columns : ";
cin>>cols;

cout<<"
 Output is : 
";

for(int i=0;i<rows;i++){
for(int j=0;j<cols;j++)
cout<<"*";
cout<<"
";
}
return 0;

}

C++ user image Admin posted 2019-01-24 14:42:36

Please login to comment

Log In


Ask New Question