import java.util.Scanner;
public class time {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int a=0,b=0;
while (cin.hasNext()) {
a=cin.nextInt();
if(a>=16&&a<=23)
{
b=a-15;
System.out.println(b);
}
else if(a<=15&&a>=0)
{
b=23-a;
System.out.println(b);
}
else
System.out.println("The time is over 0~23");
}
}
}
import java.util.Scanner;
public class time {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int a=0,b=0;
while (cin.hasNext()) {
a=cin.nextInt();
if(a>=16&&a<=23)
{
b=a-15;
System.out.println(b);
}
else if(a<=15&&a>=0)
{
b=23-a;
System.out.println(b);
}
else
System.out.println("The time is over 0~23");
}
}
}
你可以把台灣幾點時美國幾點寫一張表出來
歸納一下結果再把他寫成程式碼
import java.util.Scanner;
public class time {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int a=0,b=0;
while (cin.hasNext()) {
a=cin.nextInt();
if(a>=16&&a<=23)
{
b=a-15;
System.out.println(b);
}
else if(a<=15&&a>=0)
{
b=23-a;
System.out.println(b);
}
else
System.out.println("The time is over 0~23");
}
}
}
你可以把台灣幾點時美國幾點寫一張表出來
歸納一下結果再把他寫成程式碼