class Test_3
{
public static void main(String[] args)
{
zhuanhuantime();
}
public static void zhuanhuantime()
{
int num = 666; // 从键盘接收的数字
int tian,shi,fen,miao;
boolean falg = true;
while(falg)
{
if(num<60) // 判断秒
{
System.out.print(num+"秒");
falg = false;
}
if((num>=60)&&(num<3600)) // 判断分钟
{
fen = num/60;
miao = num%60;
//tt = num%60;
num = miao;
System.out.print(fen+"分钟");
}
if((num>=3600)&&(num<86400)) // 判断小时
{
int tt;
shi = num/3600;
fen = num%60;
tt = num%3600;
num = tt;
System.out.print(shi+"小时");
}
if(num>=86400) //判断天
{
int tt;
tian = num/86400;
tt = num%86400;
num =tt;
System.out.print(tian+"天");
}
}
}
} 作者: zouxx 时间: 2015-4-6 20:21
赞一个。作者: thoris 时间: 2015-4-6 20:35 本帖最后由 thoris 于 2015-4-6 20:45 编辑
import java.util.Scanner;
public class Test002 {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.println("请输入一个正整数");
int num=input.nextInt();