Write a program to generate the following output using only 1 printf() function. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Write a program to generate the following output using only 1 printf() function.

Output; 1 2 3 4 5 6 7 8 9 My attempt: int main() { printf("|1 2 3|\n|4 5 6|\n|7 8 9"); return 0; }

8th Nov 2021, 11:32 AM
Giggling_ddl.
6 Answers
+ 2
Usually will be needed an attempt with a question. In addition I would like to recommend first to work with the tutorial.
8th Nov 2021, 11:37 AM
JaScript
JaScript - avatar
+ 2
You sure this is C# and not C? Please recheck your language. Also, show your attempt first By the way, this can be done by using some newlines(\n), tabs (\t) and some numbers inside a single printf () function. All the best =)
8th Nov 2021, 11:38 AM
Rishi
Rishi - avatar
+ 2
Giggling_ddl. Then tag the right programming language. You tagged C#. In case you didn't know, C# is another programming language. So change your tag Also, where's your attempt?
8th Nov 2021, 11:59 AM
Rishi
Rishi - avatar
+ 2
Giggling_ddl. You're close! Remove those '|'s and add tabs instead of spaces. It'll be like below code snippet printf("1\t2\t3\n4\t5\t6\n7\t8\t9"); All the best =)
8th Nov 2021, 1:44 PM
Rishi
Rishi - avatar
+ 1
It is C programming!
8th Nov 2021, 11:39 AM
Giggling_ddl.
+ 1
Thank you 🙏
8th Nov 2021, 12:19 PM
Giggling_ddl.