+ 1

How to print this pattern in c using recursion ??

1 11 111 1111 11111

19th Jul 2022, 6:31 PM
Ravi Pandey
Ravi Pandey - avatar
8 Answers
+ 1
What have you tried so far? Can you please link your code attempt?
19th Jul 2022, 6:33 PM
Lisa
Lisa - avatar
+ 5
Your recursion doesn't have an exit condition – it would run infinitely. Also, the function doesn't print anything. You could start by defining and exit condition and printing 1 on each iteration. How to make it print multiple times per iteration is something you can add later.
19th Jul 2022, 6:55 PM
Lisa
Lisa - avatar
+ 3
Thank you for providing code. This code doesn't match the answer to your problem but it's flipped upside down. Look at what the code does and make the needed changes to make it yours https://code.sololearn.com/chbp9cMJvFE5/?ref=app
19th Jul 2022, 6:57 PM
Slick
Slick - avatar
+ 1
1. For extra confusion so you'd have to do a little work to get your answer. 2. the if statement checks to see if the number given is above 0. This is the "exit condition" mentioned by Lisa
19th Jul 2022, 7:50 PM
Slick
Slick - avatar
0
Ok
19th Jul 2022, 6:34 PM
Ravi Pandey
Ravi Pandey - avatar
19th Jul 2022, 6:38 PM
Ravi Pandey
Ravi Pandey - avatar
0
You sent me a message. What don't you understand?
19th Jul 2022, 7:32 PM
Slick
Slick - avatar
0
Slick 1.why character is used in program 2 in the if(line) what does it mean ...
19th Jul 2022, 7:47 PM
Ravi Pandey
Ravi Pandey - avatar