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 generatePattern(int);
int main() {
int n;
cout<<"Enter n: ";
cin>>n;
generatePattern(n);
return 0;
}
void generatePattern(int n){
int i,j;
for(i=1;i<=n;i++){
for(j=0;j<i;j++)
cout<<'T';
cout<<'\n';
}
}
Comments