herrDeng網內搜尋

自訂搜尋

Ads

2016年5月3日 星期二

Ex. 輸入月份,輸出"大月"、"小月"

Ex. 輸入月份,輸出"大月"、"小月"



可參考"分數轉等第"

41 則留言:

b10433038詹恭煒 提到...

import java.util.Scanner;

public class ex1

public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("輸入月份"); int x=input.nextInt(); if(x<1 || x>12) System.out.println("錯誤"); else if (x==1) System.out.println("大月"); else if (x==3) System.out.println("大月"); else if (x==5) System.out.println("大月"); else if (x==7) System.out.println("大月"); else if (x==8) System.out.println("大月"); else if (x==10) System.out.println("大月"); else if (x==12) System.out.println("大月"); else System.out.println("小月"); }

b10433026陳元凱 提到...

import java.util.Scanner;

public class ex {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

int x = input.nextInt();

if (x<=0 || x>13) System.out.println("錯誤");

else{

switch(x){

case 1: case 3: case 5: case 7: case 8: case 10: case 12:

System.out.println("大月"); break;

default:

System.out.println("小月");

}

}

}

}

B10133186 提到...

import java.util.Scanner; public class ex2 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int x = input.nextInt(); if(x<0||x>12) System.out.println("錯誤"); else{ switch(x){ case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println("大月"); break; case 4: case 6: case 9: case 11: System.out.println("小月"); break; default: System.out.println("28或29天"); } } } }

B10433023李佳明 提到...

import java.util.*; public class EX { public static void main(String[] args) { Scanner input= new Scanner(System.in); int x= input. next Int (); if(x<0 ||x>13) System.out.print("請輸入1-12的數字"); else{ switch(x){ case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.print("大月");break; case 4: case 6: case 9: case 11: System.out.print("小月");break; case 2 : System.out.print("2月比較特別呀 28天或29天"); } } } }

輸入 2

2月比較特別呀 28天或29天

B10433044 提到...

import java.util.*; public class A {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int x = input.nextInt();
if(x<1 || x>12) System.out.print("錯誤");
else switch(x){
case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.print("大月");break;
case 4: case 6: case 9: case 11:
System.out.print("小月");break; default:System.out.print("二月");
}
}
}

B10433031陳頌恩 提到...

package ex1;

import java.util.Scanner;

public class ex2 {

public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("輸入月份:"); int x=input.nextInt(); if (x<1 || x>12) System.out.println("mistake"); else { switch(x){ case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println("大月"); break; default: System.out.println("小月"); break; } }

}

}


輸入月份:
13
mistake

B10433042 提到...

import java.util.Scanner;

public class EDF { public static void main(String[] args) { Scanner input = new Scanner(System.in); int x=input.nextInt(); if(x<0 || x>12) System.out.println("錯誤"); else switch(x){ case 1: case 3: case 5: case 7: case 8: case 10: System.out.println("31"); case 2: System.out.println("28"); default: System.out.println("30"); } } }<

B10433008王靖雲 提到...

import java.util.Scanner;



public class ex01 {



public static void main(String[] args) {

Scanner input=new Scanner(System.in);

int x=input.nextInt();

switch(x){

case 1:

System.out.println("31");break;

case 2:

System.out.println("28");break;

case 3:

System.out.println("31");break;

case 4:

System.out.println("30");break;

case 5:

System.out.println("31");break;

case 6:

System.out.println("30");break;

case 7:

System.out.println("31");break;

case 8:

System.out.println("31");break;

case 9:

System.out.println("30");break;

case 10:

System.out.println("31");break;

case 11:

System.out.println("30");break;

case 12:

System.out.println("31");break;

default:

System.out.println("錯誤");

}

}



}

B10433068丁麗敏 提到...

import java.util.Scanner;



public class ex1 {



public static void main(String[] args) {

Scanner input = new Scanner(System.in);

int n=input.nextInt();

switch(n){

case 1:

System.out.println("31");break;

case 2:

System.out.println("28");break;

case 3:

System.out.println("31");break;

case 4:

System.out.println("30");break;

case 5:

System.out.println("31");break;

case 6:

System.out.println("30");break;

case 7:

System.out.println("31");break;

case 8:

System.out.println("31");break;

case 9:

System.out.println("30");break;

case 10:

System.out.println("31");break;

case 11:

System.out.println("30");break;

case 12:

System.out.println("31");break;

default:

System.out.println("錯誤");

}

}

}

B10433006張正祺 提到...

import java.util.Scanner;



public class ex01 {



public static void main(String[] args) {

Scanner input=new Scanner(System.in);

int x=input.nextInt();

switch(x){

case 1:

System.out.println("31");break;

case 2:

System.out.println("28");break;

case 3:

System.out.println("31");break;

case 4:

System.out.println("30");break;

case 5:

System.out.println("31");break;

case 6:

System.out.println("30");break;

case 7:

System.out.println("31");break;

case 8:

System.out.println("31");break;

case 9:

System.out.println("30");break;

case 10:

System.out.println("31");break;

case 11:

System.out.println("30");break;

case 12:

System.out.println("31");break;

default:

System.out.println("錯誤");

}

}

}



B10433020沈柏軍 提到...

import java.util.Scanner;



public class ex01 {



public static void main(String[] args) {

Scanner input=new Scanner(System.in);

int x=input.nextInt();

switch(x){

case 1:

System.out.println("31");break;

case 2:

System.out.println("28");break;

case 3:

System.out.println("31");break;

case 4:

System.out.println("30");break;

case 5:

System.out.println("31");break;

case 6:

System.out.println("30");break;

case 7:

System.out.println("31");break;

case 8:

System.out.println("31");break;

case 9:

System.out.println("30");break;

case 10:

System.out.println("31");break;

case 11:

System.out.println("30");break;

case 12:

System.out.println("31");break;

default:

System.out.println("錯誤");

}

}

}

B10433007張聖鑫 提到...

import java.util.Scanner;



public class ex01 {



public static void main(String[] args) {

Scanner input=new Scanner(System.in);

int x=input.nextInt();

switch(x){

case 1:

System.out.println("31");break;

case 2:

System.out.println("28");break;

case 3:

System.out.println("31");break;

case 4:

System.out.println("30");break;

case 5:

System.out.println("31");break;

case 6:

System.out.println("30");break;

case 7:

System.out.println("31");break;

case 8:

System.out.println("31");break;

case 9:

System.out.println("30");break;

case 10:

System.out.println("31");break;

case 11:

System.out.println("30");break;

case 12:

System.out.println("31");break;

default:

System.out.println("錯誤");

}

}

}



B10433027吳俊章 提到...

import java.util.*;

public class ex01 {

public static void main(String[] args) {

Scanner input=new Scanner(System.in);

int x=input.nextInt();

if(x<=0|x>12) System.out.println("錯誤");

else{

switch(x){

case 1: case 3: case 5: case 7: case 8: case 10:

case 12:

System.out.println("大月");break;

case 2: case 4: case 6: case 9: case 11:

System.out.println("小月");break;

}

}

}

}

B10433009 蔡佩樺 提到...

import java.util.*;

public class EX01 {
public static void main(String[] args) { Scanner intput=new Scanner(System.in); System.out.println("輸入月份:"); int x=intput.nextInt(); if(x<1 || x>12) System.out.println("錯誤"); else { switch(x){ case 1: case 3:case 5:case 7: case 8:case 10:case 12: System.out.println("大月");break; default: System.out.println("小月");break; } } }}

B10433083林綾萱 提到...

import java.util.Scanner;



public class ex01 {



public static void main(String[] args) {

Scanner input=new Scanner(System.in);

int x=input.nextInt();

switch(x){

case 1:

System.out.println("31");break;

case 2:

System.out.println("28");break;

case 3:

System.out.println("31");break;

case 4:

System.out.println("30");break;

case 5:

System.out.println("31");break;

case 6:

System.out.println("30");break;

case 7:

System.out.println("31");break;

case 8:

System.out.println("31");break;

case 9:

System.out.println("30");break;

case 10:

System.out.println("31");break;

case 11:

System.out.println("30");break;

case 12:

System.out.println("31");break;

default:

System.out.println("錯誤");

}

}

}



B10433053謝肇安 提到...

import java.util.Scanner;

public class ex02 {

public static void main(String[] args) {

Scanner input=new Scanner(System.in);

System.out.println("輸入月份:");

int x=input.nextInt();

if (x<1 || x>12) System.out.println("錯誤");

else {

switch(x){

case 1: case 3: case 5: case 7:

case 8: case 10: case 12:

System.out.println("大月"); break;

default:

System.out.println("小月"); break;

}

}

}

}

B10433005沈沛姍 提到...

import java.util.*;
>public class ex02 {

public static void main(String[] args) {
Scanner input=new Scanner(System.in); System.out.println("輸入月份");
int x=input.nextInt();
if(x<1 || x>12)
System.out.println("錯誤");
else {
switch(x){
case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println("大月"); break;
default:
System.out.println("小月"); } } } }


輸入月份
5
大月

B10433043彭子豪 提到...

import java.util.Scanner;

public class ex02 {

public static void main(String[] args) {

Scanner input=new Scanner(System.in);

System.out.println("輸入月份:");

int x=input.nextInt();

if (x<1 || x>12) System.out.println("error");

else {

switch(x){

case 1: case 3: case 5: case 7:

case 8: case 10: case 12:

System.out.println("大月"); break;

default:

System.out.println("小月"); break;

}

}

}

}

B10433054 孫若庭 提到...

import java.util.*;

public class ex01 {

public static void main(String[] args) {
Scanner input=new Scanner(System.in); System.out.println("輸入月份");
int x=input.nextInt();
if (x<1 || x>12) System.out.println("錯誤");
else { switch(x){
case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println("大月"); break;
default:
System.out.println("小月"); } } }

}

輸入月份
6
小月

B10433019李佳潔 提到...

import java.util.Scanner;
public class ex02 {
public static void main(String[] args) {
System.out.println("hello");
Scanner input=new Scanner(System.in); System.out.println("輸入月份:");
int x=input.nextInt();
if (x<1 || x>12) System.out.println("錯誤");
else {
switch(x){
case 1: case 3:case 5:case 7: case 8: case 10:case 12: System.out.println("大月"); break;
default:
System.out.println("小月"); break;
}
}
}
}

B10433014 提到...

import java.util.*;

public class game1 {

public static void main(String[] args) { Scanner input=new Scanner(System.in); int x=input.nextInt(); if(1>x || x>12) System.out.println("錯誤"); else switch(x){ case 1 : case 3 : case 4 : case 5 : case 6 : case 7 : case 8 : case 9 : case 10 : case 11 : case 12: System.out.println("大月"); break; default: System.out.println("小月"); } } }

B10433039游叡恩 提到...

import java.util.Scanner;



public class ex01 {



public static void main(String[] args) {

Scanner input=new Scanner(System.in);

int x=input.nextInt();

switch(x){

case 1:

System.out.println("31");break;

case 2:

System.out.println("28");break;

case 3:

System.out.println("31");break;

case 4:

System.out.println("30");break;

case 5:

System.out.println("31");break;

case 6:

System.out.println("30");break;

case 7:

System.out.println("31");break;

case 8:

System.out.println("31");break;

case 9:

System.out.println("30");break;

case 10:

System.out.println("31");break;

case 11:

System.out.println("30");break;

case 12:

System.out.println("31");break;

default:

System.out.println("錯誤");

}

}

}

b10433034陳智揚 提到...

import java.util.Scanner;



public class ex01 {



public static void main(String[] args) {

Scanner input=new Scanner(System.in);

int x=input.nextInt();

switch(x){

case 1:

System.out.println("31");break;

case 2:

System.out.println("28");break;

case 3:

System.out.println("31");break;

case 4:

System.out.println("30");break;

case 5:

System.out.println("31");break;

case 6:

System.out.println("30");break;

case 7:

System.out.println("31");break;

case 8:

System.out.println("31");break;

case 9:

System.out.println("30");break;

case 10:

System.out.println("31");break;

case 11:

System.out.println("30");break;

case 12:

System.out.println("31");break;

default:

System.out.println("錯誤");

}

}

}

B10433012 鍾仁凱 提到...



import java.util.*;

public class EX01 {
public static void main(String[] args) { Scanner intput=new Scanner(System.in); System.out.println("輸入月份:"); int x=intput.nextInt(); if(x<1 || x>12) System.out.println("錯誤"); else { switch(x){ case 1: case 3:case 5:case 7: case 8:case 10:case 12: System.out.println("大月");break; default: System.out.println("小月");break; } } }}

B10433025 提到...

package ex1; import java.util.Scanner; public class ex2 { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("輸入月份"); int x=input.nextInt(); if (x<1 || x>12) System.out.println("錯誤"); else { switch(x){ case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println("大月");break; default: System.out.println("小月");break; } }


B10433040葉峻宇 提到...

import java.util.Scanner;

public class ex02 {

public static void main(String[] args) {

Scanner input=new Scanner(System.in);

System.out.println("輸入月份:");

int x=input.nextInt();

if (x<1 || x>12) System.out.println("錯誤");

else {

switch(x){

case 1: case 3: case 5: case 7:

case 8: case 10: case 12:

System.out.println("大月"); break;

default:

System.out.println("小月"); break;

}

}

}

}

B10233019 曾文善 提到...

import java.util.Scanner;
public class ex01 {

public static void main(String[] args) {
System.out.println("嗨");

Scanner input=new Scanner(System.in);
int x=input.nextInt();
if(1>x || x>12) System.out.println("錯誤");
else{
switch(x){
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
System.out.println("大月");
break;
default:
System.out.println("小月");
}
}

}

}

B10433024陳錡諹 提到...

package ex1;

import java.util.Scanner;

public class ex2 {

public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("輸入月份:"); int x=input.nextInt(); if (x<1 || x>12) System.out.println("mistake"); else { switch(x){ case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println("大月"); break; default: System.out.println("小月"); break; } }

}

}

B10233047陳俊翔 提到...

import java.util.Scanner;
public class ex01 {

public static void main(String[] args) {
System.out.println("嗨");

Scanner input=new Scanner(System.in);
int x=input.nextInt();
if(1>x || x>12) System.out.println("錯誤");
else{
switch(x){
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
System.out.println("大月");
break;
default:
System.out.println("小月");
}
}

}

}

b10233011 吳振誠 提到...

import java.util.Scanner;

public class ex1 {

public static void main(String[] args) {
System.out.println("請輸入月份:");
Scanner input=new Scanner(System.in);
int x=input.nextInt();
if(1>x||x>12) System.out.println("error");
else{
switch(x){
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
System.out.println("大月");
break;
default:
System.out.println("小月");
}
}

}

B10433015周采萱 提到...

import java.util.Scanner;
public class month1 {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int x=input.nextInt();
if(1>x || x>12) System.out.println("error");
else{
switch(x){
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
System.out.println("大月");
break;
default:
System.out.println("小月");
}
}
}
}

B10433028陳佳勳 提到...

import java.util.Scanner;
public class ex01 {

public static void main(String[] args) {
System.out.println("嗨");

Scanner input=new Scanner(System.in);
int x=input.nextInt();
if(1>x || x>12) System.out.println("錯誤");
else{
switch(x){
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
System.out.println("大月");
break;
default:
System.out.println("小月");
}
}

}

}

B10233028 王曉琪 提到...

import java.util.Scanner;
public class ex01 {

public static void main(String[] args) {
System.out.println("嗨");

Scanner input=new Scanner(System.in);
int x=input.nextInt();
if(1>x || x>12) System.out.println("錯誤");
else{
switch(x){
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
System.out.println("大月");
break;
default:
System.out.println("小月");
}
}

}

}

B10433021 呂志信 提到...

package ex01;

import java.util.Scanner;

public class ex01 {

public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int x = input.nextInt();
if(x<1 || x>12) System.out.println("error");
else{
switch(x){
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
System.out.println("大月");
break;
default :
System.out.println("小月");
}
}
}
}

B10433030楊家睿 提到...

import java.util.Scanner;

public class ex02 {

public static void main(String[] args) {

Scanner input=new Scanner(System.in);

System.out.println("輸入月份:");

int x=input.nextInt();

if (x<1 || x>12) System.out.println("錯誤");

else {

switch(x){

case 1: case 3: case 5: case 7:

case 8: case 10: case 12:

System.out.println("大月"); break;

default:

System.out.println("小月"); break;

}

}

}

}

B10433049宋子文 提到...

package ex01;

import java.util.Scanner;

public class ex01 {

public static void main(String[] args) { Scanner input=new Scanner(System.in); int x=input.nextInt(); if(x<1 || x>12) System.out.println("error"); else{ switch(x){ case 1: case 3: case 5: case 7: case 8 : case 10 : case 12: System.out.println("大月"); break; default : System.out.println("小月"); } } }


輸入月份
6
小月

B10433023李佳明 提到...

import java.util.*; public class EX1 { public static void main(String[] args) { Scanner input= new Scanner(System.in); int x=input.nextInt(); if(x<1 ||x>13) System.out.print("請輸入1-12的數字"); else{ switch(x){ case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.print("大月");break; case 4: case 6: case 9: case 11: System.out.print("小月");break; case 2 : System.out.print("2月比較特別呀 28天或29天"); } } } }

B10433029宋狄淯 提到...

package ex1;

import java.util.Scanner;

public class ex2 {

public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("輸入月份:"); int x=input.nextInt(); if (x<1 || x>12) System.out.println("mistake"); else { switch(x){ case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println("大月"); break; default: System.out.println("小月"); break; } }

}

}


輸入月份:
13
mistake

B10433051莊孟軒 提到...

package ex01;

import java.util.Scanner;

public class ex01 {

public static void main(String[] args) { System.out.println("A"); Scanner input=new Scanner(System.in); int x=input.nextInt(); if(112) System.out.println("error"); else{ switch(x){ case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println("big moon"); break; default: System.out.println("small moon"); } } }

b10433050徐佳偉 提到...

import java.util.*;

public class ex01 {

public static void main(String[] args) {
Scanner input=new Scanner(System.in); System.out.println("輸入月份");
int x=input.nextInt();
if (x<1 || x>12) System.out.println("錯誤");
else { switch(x){
case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println("大月"); break;
default:
System.out.println("小月"); } } }

}

B10433022吳欣芸 提到...

import java.util.*;

public class m123 {

public static void main(String[] args) { Scanner input=new Scanner(System.in); int x=input.nextInt(); if(1>x||x>12)System.out.println("error"); else switch (x) { case 1:case 3:case 5:case 7:case 8:case 10:case 12: System.out.println("大月31"); break; case 4:case 6:case 9:case 11: System.out.println("小月30"); break; case 2: System.out.println("小月28、29"); break; } } }

Related Posts Plugin for WordPress, Blogger...

熱門文章