练习1

来源:互联网 发布:iPad看视频软件 编辑:程序博客网 时间:2024/06/08 15:56
//使用公式C=(5/9)(F-32)打印下列华氏温度与摄氏温度对照表。public class Test1 {public static void main(String[] args) {double c;int i,f=300;for(i=0;i<16;i++){//循环语句c=(5.0/9)*(f-32);System.out.printf("%d   %1.1f\t\n",f,c);//保留一位小数f-=20;}}}