Output JBL in Block Letters with C Programming

In summary, to output your initials in block letters, you will need to use the newline character '\n' to start a new line in your printf statements. Additionally, using the tab character '\t' can help with aligning your output. It is also possible to use only one printf statement, but it may be more difficult to format correctly.
  • #1
jaydnul
558
15
All i have to do is write a program that will output my initials (JBL) in block letters.

This is what i have done:

Code:
#include <stdio.h>
void main()
{
printf("	 JJJJJJ  BBBBBBBB  LLL");
printf("	   JJ     BB    BB    LLL");
printf("	   JJ    BBBBBBB    LLL");
printf("	   JJ    BB    BB     LLL");
printf("      JJ JJ     BB    BB    LLLLLLLL");
printf("	JJJJJ    BBBBBBBB  LLLLLLLL");
}

Now this is wrong of course. When i execute, it will print the top line with the correct number of spaces, but after the first LLL it just goes wack. I assume it is because i am not telling it when to start a new line, right? If so, how do i do that? Also, could i just use 1 printf statement instead of 6?
Thanks
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
The newline character '\n' should be added inside the "" of the printf string:

printf(" This is a line of text.\n");
 
  • #3
ahh perfect. Thank you. another problem i was having was i didn't know tab would act as a single space, so it was printing all messed up. Got it now. Thanks SteamKing
 

1. How do I output "JBL" in block letters using C programming?

To output "JBL" in block letters using C programming, you can use the printf() function and use multiple printf statements to print each letter in a block format.

2. Can I use a loop to output "JBL" in block letters using C programming?

Yes, you can use a loop to output "JBL" in block letters using C programming. You can use a for loop or a while loop to print each line of the block letters.

3. Is there a specific library or header file I need to include to output "JBL" in block letters with C programming?

No, there is not a specific library or header file needed to output "JBL" in block letters with C programming. The standard library in C already includes the necessary functions for printing and formatting text.

4. Can I change the size or color of the block letters when outputting "JBL" with C programming?

Yes, you can change the size and color of the block letters when outputting "JBL" with C programming. You can use the printf() function with escape sequences to change the font size and color of the output.

5. How can I make the block letters of "JBL" align in the center of the console when using C programming?

To make the block letters of "JBL" align in the center of the console when using C programming, you can use the printf() function with the %*s format specifier. This will allow you to specify the width of the output and center it accordingly.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
3
Views
668
  • Engineering and Comp Sci Homework Help
Replies
3
Views
881
  • Engineering and Comp Sci Homework Help
Replies
1
Views
8K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
926
  • Engineering and Comp Sci Homework Help
Replies
7
Views
996
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
12
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
17
Views
1K
Back
Top