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 <stdio.h>
#include <stdlib.h>
void generatePattern(int n){
int i,j;
for (i = 1; i <= n; i++) {
for (j = 1; j <= i; j++) {
printf("T");
}
printf("\n");
}
}
int main(){
int number;
printf("Enter n: ");
scanf("%d",&number);
generatePattern(number);
getchar();
getchar();
return 0;
}
Comments
Leave a comment