I NEED FAST HELP | Sololearn: Learn to code for FREE!

0

I NEED FAST HELP

I WANT TO PRINTF TEXT OF FIRST 8 CHARACTERS PRECEDED BY FIVE BLANKS

4/21/2021 9:57:07 PM

othneillo

11 Answers

New Answer

+1

And what is the problem?

+1

if you really want, then do not restrain yourself, take and print 😃

0

Hi Please i made some correction to my question

0

If someone inputs a string of lets say, 10 charaters, id like the compiler to pick the first 8 characters followed 5 blanks

0

Is there a printf format for that? Ive seen printf commands like printf(‘%5s’, ‘helloworld’)

0

Actually i need this info for an upcoming exam

0

set the array length to 8, itll only take that much

0

Ive gotten the answer guys printf("%5.8s\n", "Hello World\n"); /* Right-justify string with space for 15 chars, print only first 10 letters */ Thank you so much

0

othneillo, did you really want this result?🤔😳☺️

0

Not exactly but something similar. I guess my question wasnt clear enough. Sorry

0

if you want to print "Hello" with a indent of 8 characters: printf("%13.5s", "Hello World\n"); Output: Hello ................. Here's how it works: 13 is the length of the line, 5 is the number of characters in "Hello", 13-5 = 8 is the number of characters indent.