You are on page 1of 1

#include <iostream> using namespace std; int main() { int n,m; cout << "enter the lenght of the

line ";//ask user to input the length of the line cin >> n;//memorize the length of the line cout << endl; for (int i=0; i<n; i++) cout << "*"; //display the line cout << endl; //ask the user for the length of the square cout << "enter the number of line in the square "; cin >> n; cout << "enter the number of columns in the square "; cin >> m; for (int j=0; j<n; j++) //display the square { for (int k=0; k<m; k++) cout << "*"; cout << endl; } for (int i=0; i<n; i++)//display half of the square { for (int j=0; j<m; j++) if ((i>j)||(i==j)) cout <<"*"; cout << endl; } return 0; }

You might also like