Printing a Matrix of n*n

09:14 0 Comments A+ a-

Problem:
Write a program that takes size "n" from user and displays n x n matrix of stars.
Sample Run 1:
Enter Size: 3
Matrix:
***
***

***
Solution:
# include <iostream>
using namespace std;
int main()
{
int num; //num represents size of pattern
cout<<"Please enter the integer";
cin>>num;
for(int i=0;i<num;i++)
{
for(int j=0;j<num;j++)
{
cout<<"*";
}
cout<<endl;
}



return 0;

}