public class Test08 { public static void main(String[] args) { //8.使用do-while实现:输出摄氏温度与华氏温度的对照表,要求它从摄氏温度0度到250度,每隔20度为一项,对照表中的条目不超过10条。 int i=1; double c = 0; double f = 0; do{ i++; f=c * 9 / 5.0 + 32; c=c+20; System.out.println("摄氏度:"+c+"\t\t华摄氏度:"+f); }while (i<=10 && c <=250); } }
使用do-while实现:输出摄氏温度与华氏温度的对照表,要求它从摄氏温度0度到250度,每隔20度为一项,对照表中的条目不超过10条。
最新推荐文章于 2023-03-11 10:54:17 发布