Write a program that reads in a number and prints out the letter L using '*' characters with each line in the L having width n. Further, the length of the horizontal bar should be 4n, and that of the vertical bar (i.e. not including the portion overlapping with the horizontal bar) should be 3n. Thus for n=3 your program should print
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "n = ";
cin >> n;
for(int i = 0; i <3*n; i++)
cout << '*' << endl;
for(int i = 0; i < 4*n; i++)
cout << '*';
return 0;
}
Comments
Leave a comment