Splitting value into digits gives compile error

Hi

The original code works fine but I want to split the digits and print only one digit after the “.”

I tried to declare Digit1,Digit2,Digit3 as a float or int but still get the error message.

Thanks in advance for helping.

The compile error:

exit status 1
invalid operands of type 'float' and 'int' to binary 'operators%'

This my code.

#include "U8glib.h"            // U8glib library for the OLED

int  Digit1 = 0;
int  Digit2 = 0;
int  Digit3 = 0;
int analogInput = 0;
float vout = 0.0;
float vin = 0.0;
int value = 0;

U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9, 8); // D0=13, D1=11, CS=10, DC=9, Reset=8

void draw(void)
{
  //u8g.setFont(u8g_font_6x10);
  u8g.setFont(u8g_font_profont17r);        // select font
  u8g.drawStr(18, 12, "VOLTAGE");

  u8g.setPrintPos(33, 40);
  u8g.drawRFrame(15, 20, 100, 30, 10);     // draws frame with rounded edges

  // u8g.println(vin);                     //Prints the voltage

  u8g.println(Digit1);
  u8g.println(Digit2);
  u8g.drawStr(10, 30, ".");
  u8g.println(Digit3);

  u8g.println("V");
}
void setup()
{
  pinMode(analogInput, INPUT);
}
void loop()
{
  value = analogRead(analogInput);
  vout = (5.0 / 1024.0) * value; //((value * 5.0) / 1024.0); // Both gives same result
  vin = vout * 11.09;           //Resistor divider
  if (vin < 0.09)
  {
    vin = 0.0;                 //statement to quash undesired reading !

    //----------------------

    Digit1 = (vin / 1000) ;
    vin %= 1000;

    Digit2 = (vin / 100) ;
    vin %= 100;

    Digit3 = (vin / 10);
    vin %= 10;

    //--------------------------

  }
  u8g.firstPage();
  do
  {
    draw();
  }
  while ( u8g.nextPage() );
  delay(500);
}

i don't believe the modulus operator, "%", is defined for float variable types.

just store the value as an "int" data type