Serial is printing character by character

I have created a code that receives input from the serial monitor then prints it again but it prints the numbers one by one

10 - 48 = -38.

Change the serial monitor line ending to 'no line ending'.

But then you need to decide where your number ends ...

Maybe leave it at line-feed, and use that to tell your sketch you have finished typing in your number.

And you forgot the "multiply by ten" as new digits come in.

I would suggest to study Serial Input Basics

And I would suggest not to use images of code and serial monitor :cry: Hopefully OP will not post 20 plus screenshots when his code grows to a few 100 lines :cold_sweat:

@crazyboy39821, please spend some time reading How to get the best out of this forum

Your program does exactly what you wrote in the code.
Reads one byte, calculates a digit, prints "I received : ", prints one digit.
The last number is the Newline character ('\r' '\n' = 10), which your serial monitor adds.
10 - 48 = -38
Everything is correct.
What did you want to get?

sp. '\n' == 10 == line-feed

'\r' == 13 == carriage return

1 Like

See my tutorial on Arduino Software Solutions for various ways to read from Serial with their pros and cons.

Serial.read() returns one character. If you want to read a multi-digit number, use Serial.parseInt().