Just to mention, some students have double f = 9.0/5*C + 32;, this is not possible.
You may be thinking that the program will be executed in order, but Java does not. Java will give you double f = 9.0/(5*C) + 32;,
If you must put C behind, unless you double f = (9.0/5)*C + 32;
package com.temp;
/**
* @Author lanxiaofang
* @email [email protected]
* @date 2020/09/14 08:10
*/
public class CToF {
public static void main(String[] args) {
int c1 = 0;
for(int i = 1; i < 10; i++){
double f = 9.0*c1/5+32;
System.out.println(c1 +"C --> "+ f +"F");
c1+=5;
}
}
}