View Code of Problem 53

#include<iostream>
using namespace std;

void line(int n, int m) {
	int x = n - m;
	while (x--) cout << ' ';
	for (int i = 1; i <= m; i++) cout << '*';
	for (; m > 1; m--) cout << '*';
	cout << endl;
}
int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)  line(n, i);
	for (int i = n - 1; i; i--)  line(n, i);
	return 0;
}

Double click to view unformatted code.


Back to problem 53