by CodeChum Admin
They said pyramids were created by aliens, so if you can make a pyramid you might be able to qualify as an alien.
Instructions:
Input
1. Integer n
Output
Enter·n:·4
T
TT
TTT
TTTT
#include <iostream>
using namespace std;
void generatePatern(int n) {
for (int i=0; i<n; i++) {
for (int j=0; j<=i; j++) {
cout <<'T';
}
cout << endl;
}
}
int main() {
int n;
cout << "Enter n: ";
cin >> n;
generatePatern(n);
return 0;
}
Comments
Leave a comment