Why it didn't work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why it didn't work

Hola everyone l am stocked about why when I input like what a wonderful world \n\n# but it just show me the num of words without \n num? Help me please https://code.sololearn.com/cq7hT18f6jkk/?ref=app

27th Sep 2020, 2:14 AM
Sherry_Lim
Sherry_Lim - avatar
2 Answers
+ 1
Because the '\n' character is a new line, not a literal \n. Try entering this: hello world # // not "hello world#"
27th Sep 2020, 2:46 AM
Slick
Slick - avatar
0
First, you are counting in W_num the number of characters, not the number of words. Second, your code is correct, just be sure to input a newline instead of \n (byte value 0xA). You can test it adding a printf("%x ", num); as first instruction of your while loop. If you for example input solo learn # and click SUBMIT, the output will be, as expected 73 6f 6c 6f a 6c 65 61 72 6e a There are 2 11
27th Sep 2020, 2:53 AM
Bilbo Baggins
Bilbo Baggins - avatar