S= 1/r+s equals s=0.
So there is an error that the divisor is 0.
If the data types of a and s are changed to double in this code, the final result is
If r is not equal to 0, then a = R.