Hi, kind of a strange question but can anyone understand why
with the callCode:double rgbTo1 (int rgb){ return rgb/255; }can return 0?Code:rgbTo1(240);
Hi, kind of a strange question but can anyone understand why
with the callCode:double rgbTo1 (int rgb){ return rgb/255; }can return 0?Code:rgbTo1(240);
Because 240/255 is 0. (0 with remainder 240, more specifically, but you didn't ask for the remainder.)
If you want the decimal value to be returned, change your code to this:
Code:double rgbTo1 (int rgb){ return rgb/255.0; }