How to write in Serial Monitor what I enter?

Daniel_DSO:
Ok, It's works zoomkat. But it keep printing separated.

For example, I enter with number 259, but print one under the other, like: 2
5
9

I like to print in the same line, like 259.
What should I do?

Thanks.

Did you type in 259 and hit enter, or did you type 2, hit enter, type 5, hit enter, type 9, hit enter? You can add an end of packet delimiter (the default serial monitor settings do not add one) like a comma in the below code. The delimiter indicates the end of the character string being sent and starts processing of the code.

//zoomkat 3-5-12 simple delimited ',' string parse 
//from serial port input (via serial monitor)
//and print result out serial port

String readString;

void setup() {
  Serial.begin(9600);
  Serial.println("serial delimit test 1.0"); // so I can keep track of what is loaded
}

void loop() {

  //expect a string like wer,qwe rty,123 456,hyre kjhg,
  //or like hello world,who are you?,bye!,
  
  if (Serial.available())  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == ',') {
      //do stuff
      Serial.println(readString); //prints string to serial port out
      readString=""; //clears variable for new input      
     }  
    else {     
      readString += c; //makes the string readString
    }
  }
}