Write a nested for loop that will draw the following pattern
Write a nested for loop that will draw the following pattern after asking the user how many columns and rows of starts need to be drawn. Given the following input the output should be as the following How many rows of starts? How many columns of starts?
Solution
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int rows,coloumns, i,j;
cout<<\"How many rows of stars?\";
cin>>rows;
cout<<\"How many coloumns of stars?\";
cin>>coloumns;
for(i=0;i<rows;i++)
{
for(j=0;j<coloumns;j++)
{
cout<<\"*\";
}
cout<<\"\ \";
}
getch();
}
