[Solved] Integer Math Help

I'm a bit rusty from my CS151 class...

Remind me the proper way of doing this:

I'm using a voltage divider with a potentiometeron A1 to determine a volume level. Using analogRead() I will get an int between 0-1023.

I have an alarm circuit connected to A0. Using analogWrite() I can input a value between 0-255.

Basically I need to do analogRead/4. If I am storing those variables as ints will it automatically do all the rounding that needs to be done. How about in the case of 1023/4 = 255.75? Do I need to use an if/then to keep that at <255?

By default, there is no rounding, only truncation, so it isn't a worry.

It is simple to check boundary conditions like this on the actual hardware if your not sure.

void setup()
{
  Serial.begin(115200);
  
  Serial.print("1023/4=");
  Serial.println(1023/4);
}

void loop()
{
}

produces

1023/4=255