輸入出生年份,輸出生肖
參考解答:
herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
計算你的BMI
-
1. 利用遞迴input n算2^n 2. 用C算GCD(3333,456)
-
請用 C/C++/java寫一簡易程式
-
BMI (Body Mass Index)= 體重 (kg) / 身高 ^2(m 2 ) 在台灣,行政院衛生署乃根據其相關研究,於2002年4月公佈台灣成人肥胖標準: BMI<18.5 為過輕, 18.5≦BMI<24 為正常體重, 24≦BMI<27 為過重, BM...
-
用 C/C++算上學期加權平均
-
輸出 A A A A A A A A A A A A A A A
-
計算你上學期加權平均
-
需要練習的Java程式:
27 則留言:
import java.util.Scanner;
public class aa {
public static void main(String[] args) {
int x,y;
Scanner input=new Scanner(System.in);
System.out.print("輸入出生年");
x=input.nextInt();
y=(x-1600)%12;
if(y==0)
System.out.print("鼠");
else if(y==1)
System.out.print("牛");
else if(y==2)
System.out.print("虎");
else if(y==3)
System.out.print("兔");
else if(y==4)
System.out.print("龍");
else if(y==5)
System.out.print("蛇");
else if(y==6)
System.out.print("馬");
else if(y==7)
System.out.print("羊");
else if(y==8)
System.out.print("猴");
else if(y==9)
System.out.print("雞");
else if(y==10)
System.out.print("狗");
else if(y==11)
System.out.print("豬");
}
}
import java.util.Scanner;
public class ex01 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int x; int r;
Scanner input=new Scanner (System.in);
System.out.print("出生年份");
x=input.nextInt();
r=(x-1960)%12;
r=(r+12)%12;
if(r==0)
System.out.print("生肖鼠");
else if(r==1)
System.out.print("生肖牛") ;
else if(r==2)
System.out.print("生肖虎") ;
else if(r==3)
System.out.print("生肖兔") ;
else if(r==4)
System.out.print("生肖龍") ;
else if(r==5)
System.out.print("生肖蛇") ;
else if(r==6)
System.out.print("生肖馬") ;
else if(r==7)
System.out.print("生肖羊") ;
else if(r==8)
System.out.print("生肖猴") ;
else if(r==9)
System.out.print("生肖雞") ;
else if(r==10)
System.out.print("生肖狗") ;
else
System.out.print("生肖豬") ;
}
}
import java.util.Scanner;
public class c1 {
public static void main(String[] args) {
int x, j;
Scanner input =new Scanner(System.in);
System.out.println("請輸入(西元)年號");
x=input.nextInt();
j=(x-1960)%12;
System.out.println("生肖");
if(j==0)
System.out.println("鼠");
if(j==1)
System.out.println("牛");
if(j==2)
System.out.println("虎");
if(j==3)
System.out.println("兔");
if(j==4)
System.out.println("龍");
if(j==5)
System.out.println("蛇");
if(j==6)
System.out.println("馬");
if(j==7)
System.out.println("羊");
if(j==8)
System.out.println("猴");
if(j==9)
System.out.println("雞");
if(j==10)
System.out.println("狗");
if(j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class h14 {
public static void main(String[] args) {
int x,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
x=input.nextInt();
j=((x-1960)+12)%12;
if (j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else
System.out.println("豬");
}
}
import java.util.Scanner;
public class house1016 {
public static void main(String[] args) {
int x, j;
Scanner input =new Scanner(System.in);
System.out.println("年號");
x=input.nextInt();
j=(x-1960)%12;
System.out.println("生肖");
if(j==0)
System.out.println("鼠");
if(j==1)
System.out.println("牛");
if(j==2)
System.out.println("虎");
if(j==3)
System.out.println("兔");
if(j==4)
System.out.println("龍");
if(j==5)
System.out.println("蛇");
if(j==6)
System.out.println("馬");
if(j==7)
System.out.println("羊");
if(j==8)
System.out.println("猴");
if(j==9)
System.out.println("雞");
if(j==10)
System.out.println("狗");
if(j==11)
System.out.println("豬");
}
}
import java.util.*;
public class ex1 {
public static void main(String[] args) {
int x, j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
x=input.nextInt();
j=((x-1960+12)%12);
if (j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else
System.out.println("豬");
}
}
import java.util.Scanner;
public class e19 {
public static void main(String[] args) {
int x,y;
Scanner input=new Scanner(System.in);
System.out.println("出生年份");
x=input.nextInt();
y=((x-1960)+12)%12;
if(y==0)
System.out.println("鼠");
else if(y==1)
System.out.println("牛");
else if(y==2)
System.out.println("虎");
else if(y==3)
System.out.println("兔");
else if(y==4)
System.out.println("龍");
else if(y==5)
System.out.println("蛇");
else if(y==6)
System.out.println("馬");
else if(y==7)
System.out.println("羊");
else if(y==8)
System.out.println("猴");
else if(y==9)
System.out.println("雞");
else if(y==10)
System.out.println("狗");
else
System.out.println("豬");
}
}
import java.util.Scanner;
public class ex_01 {
public static void main(String[] args) {
int x,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
x=input.nextInt();
j=((x-1960)+12)%12;
if (j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class ex_01 {
public static void main(String[] args) {
int x,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
x=input.nextInt();
j=((x-1960)+12)%12;
if (j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class ex1016 {
public static void main(String[] args) {
int x,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
x=input.nextInt();
j=((x-1960)+12)%12;
if (j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class ex1016 {
public static void main(String[] args) {
int x,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
x=input.nextInt();
j=((x-1960)+12)%12;
if(j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class vghj858 {
public static void main(String[] args) {
int x,y;
Scanner input=new Scanner(System.in);
System.out.print("給我你的出生年份");
x=input.nextInt();
y=(x-1192)%12;
if (y==0)System.out.print("mouse");
else if (y==1)System.out.print("cow");
else if (y==2)System.out.print("tiger");
else if (y==3)System.out.print("rabbit");
else if (y==4)System.out.print("dragon");
else if (y==5)System.out.print("snake");
else if (y==6)System.out.print("horse");
else if (y==7)System.out.print("goat");
else if (y==8)System.out.print("monkey");
else if (y==9)System.out.print("chicken");
else if (y==10)System.out.print("dog");
else if (y==11)System.out.print("PIG");
}
}
import java.util.Scanner;
public class ex1 {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.print("出生年:");
int x=input.nextInt();
int r;
r=(x-1960)%12;
r=(r+12)%12;
if (r==0) System.out.print("鼠年");
else if (r==1) System.out.print("牛年");
else if (r==2) System.out.print("虎年");
else if (r==3) System.out.print("兔年");
else if (r==4) System.out.print("龍年");
else if (r==5) System.out.print("蛇年");
else if (r==6) System.out.print("馬年");
else if (r==7) System.out.print("羊年");
else if (r==8) System.out.print("猴年");
else if (r==9) System.out.print("雞年");
else if (r==10) System.out.print("狗年");
else if (r==11) System.out.print("豬年");
}
}
import java.util.Scanner;
public class happy2 {
public static void main(String[] args) {
int x,y;
Scanner input=new Scanner(System.in);
System.out.print("出生年份");
x=input.nextInt();
y=(x-1960)%12;
if (y==0)System.out.print("鼠");
else if (y==1)System.out.print("牛");
else if (y==2)System.out.print("虎");
else if (y==3)System.out.print("兔");
else if (y==4)System.out.print("龍");
else if (y==5)System.out.print("蛇");
else if (y==6)System.out.print("馬");
else if (y==7)System.out.print("羊");
else if (y==8)System.out.print("猴");
else if (y==9)System.out.print("雞");
else if (y==10)System.out.print("狗");
else if (y==11)System.out.print("豬");
}
}
import java.util.Scanner;
public class vghj858 {
public static void main(String[] args) {
int x,y;
Scanner input=new Scanner(System.in);
System.out.print("給我你的出生年份");
x=input.nextInt();
y=(x-1192)%12;
if (y==0)System.out.print("mouse");
else if (y==1)System.out.print("cow");
else if (y==2)System.out.print("tiger");
else if (y==3)System.out.print("rabbit");
else if (y==4)System.out.print("dragon");
else if (y==5)System.out.print("snake");
else if (y==6)System.out.print("horse");
else if (y==7)System.out.print("goat");
else if (y==8)System.out.print("monkey");
else if (y==9)System.out.print("chicken");
else if (y==10)System.out.print("dog");
else if (y==11)System.out.print("PIG");
}
}
import java.util.Scanner;
public class vghj858 {
public static void main(String[] args) {
int x,y;
Scanner input=new Scanner(System.in);
System.out.print("給我你的出生年份");
x=input.nextInt();
y=(x-1192)%12;
if (y==0)System.out.print("mouse");
else if (y==1)System.out.print("cow");
else if (y==2)System.out.print("tiger");
else if (y==3)System.out.print("rabbit");
else if (y==4)System.out.print("dragon");
else if (y==5)System.out.print("snake");
else if (y==6)System.out.print("horse");
else if (y==7)System.out.print("goat");
else if (y==8)System.out.print("monkey");
else if (y==9)System.out.print("chicken");
else if (y==10)System.out.print("dog");
else if (y==11)System.out.print("PIG");
}
}
import java.util.Scanner;
public class e029 {
public static void main(String[] args) {
int x,y;
Scanner input=new Scanner(System.in);
System.out.println("出生年份");
x=input.nextInt();
y=((x-1960)+12)%12;
if(y==0)
System.out.println("鼠");
else if(y==1)
System.out.println("牛");
else if(y==2)
System.out.println("虎");
else if(y==3)
System.out.println("兔");
else if(y==4)
System.out.println("龍");
else if(y==5)
System.out.println("蛇");
else if(y==6)
System.out.println("馬");
else if(y==7)
System.out.println("羊");
else if(y==8)
System.out.println("猴");
else if(y==9)
System.out.println("雞");
else if(y==10)
System.out.println("狗");
else
System.out.println("豬");
import java.util.Scanner;
public class A10433043 {
public static void main(String[] args) {
int X,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
X=input.nextInt();
j=((X-1960)+12)%12;
if(j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class A10433043 {
public static void main(String[] args) {
int X,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
X=input.nextInt();
j=((X-1960)+12)%12;
if(j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class A10433043 {
public static void main(String[] args) {
int X,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
X=input.nextInt();
j=((X-1960)+12)%12;
if(j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class A10433043 {
public static void main(String[] args) {
int X,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
X=input.nextInt();
j=((X-1960)+12)%12;
if(j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class ex {
public static void main(String[] args) {
Scanner z =new Scanner(System.in );
System.out.print("輸入出生年份:");
int b=z.nextInt();
int x ;
x=(b-100)%12;
if (x==0) System.out.print("鼠");
else if (x==1) System.out.print("牛");
else if (x==2) System.out.print("虎");
else if (x==3) System.out.print("兔");
else if (x==4) System.out.print("龍");
else if (x==5) System.out.print("蛇");
else if (x==6) System.out.print("馬");
else if (x==7) System.out.print("羊");
else if (x==8) System.out.print("猴");
else if (x==9) System.out.print("雞");
else if (x==10) System.out.print("狗");
else if (x==11) System.out.print("豬");
}
import java.util.Scanner;
public class Ex01166 {
public static void main(String[] args) {
Scanner z=new Scanner(System.in);
System.out.print("輸入出生年份:");
int b=z.nextInt();
int x;
x=(b-1960)%12;
if(x==0)System.out.print("鼠");
else if(x==1)System.out.print("牛");
else if(x==2)System.out.print("虎");
else if(x==3)System.out.print("兔");
else if(x==4)System.out.print("龍");
else if(x==5)System.out.print("蛇");
else if(x==6)System.out.print("馬");
else if(x==7)System.out.print("羊");
else if(x==8)System.out.print("猴");
else if(x==9)System.out.print("雞");
else if(x==10)System.out.print("狗");
else if(x==11)System.out.print("豬");
}
}
import java.util.Scanner;
public class a123 {
public static void main(String[] args) {
System.out.print("出生年份");
Scanner input=new Scanner(System.in);
int x=input.nextInt();
x=(x-1960)%12;
if(x<0) x+=12;
String xx="鼠牛虎兔龍蛇馬羊猴雞狗豬";
System.out.println(xx.charAt(x));
}
}
package jimmy;
import java.util.Scanner;
public class good {
public static void main(String[] args) {
Scanner a =new Scanner(System.in);
System.out.print("輸入出生年份:");
int b= a.nextInt();
int c; c=(b-1960)%12;
if (c==0)System.out.print("鼠");
else if(c==1)System.out.print("牛");
else if(c==2)System.out.print("虎");
else if(c==3)System.out.print("兔");
else if(c==4)System.out.print("龍");
else if(c==5)System.out.print("蛇");
else if(c==6)System.out.print("馬");
else if(c==7)System.out.print("羊");
else if(c==8)System.out.print("侯");
else if(c==9)System.out.print("雞");
else if(c==10)System.out.print("狗");
else if(c==11)System.out.print("豬");
package jimmy;
import java.util.Scanner;
public class good {
public static void main(String[] args) {
Scanner a =new Scanner(System.in);
System.out.print("輸入出生年份:");
int b= a.nextInt();
int c; c=(b-1960)%12;
if (c==0)System.out.print("鼠");
else if(c==1)System.out.print("牛");
else if(c==2)System.out.print("虎");
else if(c==3)System.out.print("兔");
else if(c==4)System.out.print("龍");
else if(c==5)System.out.print("蛇");
else if(c==6)System.out.print("馬");
else if(c==7)System.out.print("羊");
else if(c==8)System.out.print("侯");
else if(c==9)System.out.print("雞");
else if(c==10)System.out.print("狗");
else if(c==11)System.out.print("豬");
}
}
package jimmy;
import java.util.Scanner;
public class good {
public static void main(String[] args) {
Scanner a =new Scanner(System.in);
System.out.print("輸入出生年份:");
int b= a.nextInt();
int c; c=(b-1960)%12;
if (c==0)System.out.print("鼠");
else if(c==1)System.out.print("牛");
else if(c==2)System.out.print("虎");
else if(c==3)System.out.print("兔");
else if(c==4)System.out.print("龍");
else if(c==5)System.out.print("蛇");
else if(c==6)System.out.print("馬");
else if(c==7)System.out.print("羊");
else if(c==8)System.out.print("侯");
else if(c==9)System.out.print("雞");
else if(c==10)System.out.print("狗");
else if(c==11)System.out.print("豬");
}
}
張貼留言