Created
November 23, 2018 14:36
-
-
Save feynon/5a8d29b4a86390e61f0fab34f3871564 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
ABCDE | |
FGHI | |
JKL | |
MN | |
O | |
*/ | |
#include <stdio.h> | |
void printrecur(int n, int i) | |
{ | |
static char c='A'; | |
static int d=1; | |
if(n<1){ | |
return; | |
} | |
if(i <= n){ | |
printf("%c",c); | |
c++; | |
printrecur(n, i+1); | |
} | |
else{ | |
printf("\n"); | |
for(int i=0;i<d;i++) | |
printf(" "); | |
d++; | |
printrecur(n-1, 1); | |
} | |
} | |
int main() | |
{ | |
/* | |
int i, j, rows; | |
printf("Enter the number of rows = \n"); | |
scanf("%d", &rows); | |
rows--; | |
char c ='A'; | |
for(i = 0; i <= rows; i++) | |
{ | |
for(j=1; j<=i; j++) | |
{ | |
printf(" "); | |
} | |
for(j=i; j<=rows;j++) | |
{ | |
printf("%c",c); | |
c++; | |
} | |
printf("\n"); | |
} | |
*/ | |
int n; | |
printf("Kya hai? - "); | |
scanf("%d", &n); | |
printrecur(n, 1); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment