导航

L1-004 计算摄氏温度 (5 分)java

Posted on 2018-11-16 21:18  风紧扯不扯呼  阅读(232)  评论(0)    收藏  举报

L1-004 计算摄氏温度 (5 分)

import java.util.Scanner;
/**
		 * 
		 * @author 曹家伟
		 *
		 */
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		if(n>32) {
			System.out.print("Celsius = "+5*(n-32)/9);
		}
		else if(n<32){
			System.out.print("Celsius = "+(int)(-(5*(32-n)/9)));
		}else {
			System.out.print("Celsius = "+0);

		}
	}

}