函数运行结果是输出一个表格如下:
源代码如下:
public class First{
public static void main(String args[]){
System.out.println("Kilograms Pounds | Pounds Kilograms");
int x;
int y;
for(x=1,y=20;x<=199;x+=2,y+=5){
double p=2.2*x;
double k=y/2.2;
System.out.printf("%-3d %6.1f | %-6d %9.2f",x,p,y,k);
System.out.print("\n");
}
}
}
原文地址:https://blog.51cto.com/14232799/2367627
时间: 2024-10-17 21:54:52