0

Printing number patterns in c

User inputs two numbers, I need to find their sum (which will be two-digit number at most) and then print those two digits using stars. For example: Input: 8 7 Output: * ***** * * * ***** * * * ***** I thought I could do it like this: -for loop which will run twice (once for each digit) -in this for loop I wrote how each of the 10 digits should be printed -in the first run I print first digit, then in second the second digit But it prints my digits one under another. How do I make it print digits next to each other?

19th Nov 2019, 7:21 PM
mel1705
mel1705 - avatar
3 Answers
+ 1
You need to print the whole line: * ***** If you are in the second line you can't jump back to the first line.
19th Nov 2019, 7:39 PM
Denise Roßberg
Denise Roßberg - avatar
0
Denise Roßberg Yep, I know that. But I don't know how to do a combo of two digits (since there are 100 possible outputs) any other way.
19th Nov 2019, 7:42 PM
mel1705
mel1705 - avatar
0
Make all digits pattern 0 to 9, and use switch case to print for individuals...
19th Nov 2019, 7:59 PM
Jayakrishna 🇼🇳