user3936: 
I cant understand what is going on here , I was trying to find way to send through Serial a number for example 12 and then extract from it number 1 and 2 and store them in two different variables , but suddenly i was unable to make a simple division !!

user3973: Anonymous Penguin's code works for me on an Uno after fixing a couple of typos.  It is often best to make sure that both the numerator and the denominator are floats to ensure that the result is also treated as a float.  So please try the following where the 10 is replaced with a 10.0:
while(Serial.available()) 
{
  float number = (float)(Serial.read() - 48) / 10.0;
  Serial.println(number, 4);
}

If you want to deal with each digit separately an array might be best but that will depend on your end goal.  
const int MAX_LENGTH = 10;
char buffer[MAX_LENGTH];
char lineFeed = 10;

int length = Serial.readBytesUntil(lineFeed, buffer, MAX_LENGTH);
int i = 0;
while( i < length )
{
  //do what ever needs to be done to each character here, I'll just convert them to an int and print them as an example
  Serial.println( buffer[i]-48 );
  i++;
}


user220: Do you want to eventually do 12 / 10 or 1 / 10 and 2 / 10? If the second one, you'll have to read all the serial values into an array and convert those characters to their plain integer values (subtracting 48 from each value). After that, you'll have to add them together with the correct placeholders (A * 100 + B * 10 + C).
Basically, the read() function returns one character in the ASCII format. ACII basically representing characters on your screen with numbers. 48 displays a 0 on your screen, 49 a 1, and so on.
You're also facing a problem where your numbers are getting truncated. This means it cuts off the decimal. For when you send 100, it is 48 / 10 = 4.8, however 4.8 becomes just 4. The same thing happens for 49.
To fix this, you need to use a float data type. This allows decimal values. You also want to make sure that the conversion from float to string works correctly for the Serial.print() so you don't end up with 4 again.
Final code:
while(Serial.available()) {
  float number = (float)(Serial.read() - 48) / 10;
  Serial.println(number, 4);
}


3936: <p><img src="https://i.stack.imgur.com/2LYkt.jpg" alt="enter image description here"></p>

<p>I cant understand what is going on here , I was trying to find way to send through Serial a number for example 12 and then extract from it number 1 and 2 and store them in two different variables , but suddenly i was unable to make a simple division !!</p>
 3973: <p>Anonymous Penguin's code works for me on an Uno after fixing a couple of typos.  It is often best to make sure that both the numerator and the denominator are floats to ensure that the result is also treated as a float.  So please try the following where the 10 is replaced with a 10.0:</p>

<pre><code>while(Serial.available()) 
{
  float number = (float)(Serial.read() - 48) / 10.0;
  Serial.println(number, 4);
}
</code></pre>

<p>If you want to deal with each digit separately an array might be best but that will depend on your end goal.  </p>

<pre><code>const int MAX_LENGTH = 10;
char buffer[MAX_LENGTH];
char lineFeed = 10;

int length = Serial.readBytesUntil(lineFeed, buffer, MAX_LENGTH);
int i = 0;
while( i &lt; length )
{
  //do what ever needs to be done to each character here, I'll just convert them to an int and print them as an example
  Serial.println( buffer[i]-48 );
  i++;
}
</code></pre>
 220: <p>Do you want to eventually do <code>12 / 10</code> or <code>1 / 10</code> and <code>2 / 10</code>? If the second one, you'll have to read all the serial values into an array and convert those characters to their plain integer values (subtracting 48 from each value). After that, you'll have to add them together with the correct placeholders (<code>A * 100 + B * 10 + C</code>).</p>

<p>Basically, the <code>read()</code> function returns <strong>one character in the ASCII format</strong>. ACII basically representing characters on your screen with numbers. 48 displays a 0 on your screen, 49 a 1, and so on.</p>

<p>You're also facing a problem where your numbers are getting truncated. This means it cuts off the decimal. For when you send <code>100</code>, it is <code>48 / 10 = 4.8</code>, however <code>4.8</code> becomes just <code>4</code>. The same thing happens for 49.</p>

<p>To fix this, you need to use a <code>float</code> data type. This allows decimal values. You also want to make sure that the conversion from float to string works correctly for the <code>Serial.print()</code> so you don't end up with <code>4</code> again.</p>

<p>Final code:</p>

<pre><code>while(Serial.available()) {
  float number = (float)(Serial.read() - 48) / 10;
  Serial.println(number, 4);
}
</code></pre>
