Serial.println won't format DEC
I finally figured it out. Apparently, when I call Serial.read() and assign it to &quot;int rc&quot;, It sort of converts the actual ASCII values into integer. So reading the number 3 from the Serial monitor and assigning it to rc stores 51 in rc. So the trick I found to that was to use
int rc = Serial.read()-'0'

That way, I am storing 51-48 which is, 3 (Since 48 is the ASCII value for 0).
Thanks.