double seconds(int ms) { double x = ms; return x/1000.0; }It is not really necessary to have variable x. You can convert from int to double using (double), and write
double seconds(int ms) { return ((double) ms)/1000.0; }You can also perform an operation between an integer and a real number. The integer will automatically be converted to a real number. So you can write
double seconds(int ms) { return ms/1000.0; }But
double seconds(int ms) { return ms/1000; }does not work because it divides two integers, so it throws away the fractional part.