Converting int into char array.

Awesome! Thanks for this. I also found a way using modulus like you said. However I am getting roughly the same number no matter what voltage analogRead reads. Here is my revised code. I am going to use the sprintf method and see if it makes any difference. Thanks!

int val = 0, val1 = 0, val2 = 0, val3 = 0, finalval = 0, first, second, third;

void setup() {

  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  delay(5000);
}

void loop() {

  val = analogRead(2);
  
  finalval = val;
  
  int one = finalval / 100;
  int two = (finalval / 10) % 10;
  int three = finalval % 10;
  
  first = 0;
  while (first != one) {
    
    tone(1, 4500);
    delay(250);
    noTone(1);
    delay(250);
    first++;
  }
  
  delay(2000);
  
  second = 0;
  while (second != two) {
    
    tone(1, 4500);
    delay(250);
    noTone(1);
    second++;
    delay(250);
  }
  
  delay(2000);
  
  third = 0;
  while (third != three) {
    
    tone(1, 4500);
    delay(250);
    noTone(1);
    third++;
    delay(250);
  }
  
  delay(5000);
  
}