7-2 Java-Convert the value into hours and minutes
分数 10
全屏浏览
作者 马新娟
单位 山东理工大学
Write a program that declares a variable of integer type that represents the number of minutes worked on a job and assign it a value 197. Convert the value into hours and minutes. Using console windows to display the result.
输入格式:
输出格式:
Total time on job is: 197minutes
which is 3 hours and 17 minutes.
输入样例:
输出样例:
Total time on job is: 197minutes which is 3 hours and 17 minutes.
代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB
栈限制
8192 KB
public class Main { public static void main(String [] args) { int n=197; System.out.println("Total time on job is: "+n+"minutes"); System.out.println("which is " +n/60+" hours and "+n%60+ " minutes."); } }