Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

160 We want to create strings with the following patterns for n = 0,1,2,3,4,5,6,

ID: 3763656 • Letter: 1

Question

160

We want to create strings with the following patterns for n = 0,1,2,3,4,5,6,7,...
   <-- empty string  
a
ab
abca
abcadab
abcadabeabca
abcadabeabcafabcadab
abcadabeabcafabcadabgabcadabeabca
...

Define a recursive function
string pattern2(int n)
that returns the correct patterns for n = 0,1,2,3,4,5,6,7 and beyond.
(Notice the relationship between a given line and the lines before it.)
Hint: you'll need two recursive calls, somewhat like the code for Fibonacci.
The current character , char ('a' + (n-1)), is placed between the results of those calls.
Don't worry about what happens when n gets big or goes beyond 26,
your code will only be tested for small values of n.

Explanation / Answer

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j, n;
char ch;
printf(" Enter number of Rows");
scanf("%d",&n);
for(i = 1;i<= n;i++)
{
printf(" ");
ch = 'A';
for(j = 1;j<=i;j++)
{
    printf(" %c",ch);
    ch++;
}
}
getch();

}

i didnt understand exactly what do you want.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote