I meant it was supposed to be picture recognition and then gpt said it was supposed to be misidentifying your code
0 Answer
I meant it was supposed to be picture recognition and then gpt said it was supposed to be misidentifying your code
Part of this answer references GPT, GPT_Pro to better solve the problem
The problem in this question arises in the conversion formula in the code. The formula for converting Celsius to Fahrenheit is: °F =(°C × 9/5) + 32. In your code, you wrote 9321 instead of 9/5, which obviously does not meet the requirements, so the output is 68. To fix this problem, simply change 9321 to 9/5, and the modified code looks like this:
import java.util.Scanner;
public class Changef {
public static void main(String args[]){
System.out.println("请输入摄氏温度 ");
Scanner reader=new Scanner(System.in);
double m =reader.nextDouble();
double n = m * 9/5 + 32;
System.out.println("华氏温度为:"+n) ;
}
}
Once you've made your changes, enter 20 degrees Celsius and you'll normally get 68 degrees Fahrenheit.
The above is the answer to this question. In summary, when writing code, we should pay attention to the correctness of formula calculation, logical correctness and grammatical correctness to avoid bugs or unnecessary errors.
If the answer is helpful, please accept it.
there is something wrong with the image recognition, at least, look at yourself
I run your code and the result is
请输入摄氏温度
36
华氏温度为:96.8
So the code should be fine, recompile and try
in execution这家伙很懒,什么都没留下...