Ex. 輸入月份,輸出"大月"、"小月"
可參考"分數轉等第"
herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
先說明一下這是後知後覺的解答,所謂後知就是股票價格已知存在陣列(清單),當然就要用迴圈練習,雙迴圈暴力解需時O(n**2),當然不用,採python單一迴圈解答「最佳股票的買賣時機#LeetCode 121 Best Time to Buy and Sell Stock」,解...
-
你會用C的算子sizeof?
-
XOR prefixsum CPP python解Leetcode 1829 Maximum XOR for Each Query 其實這裡考慮的是元素個數為2^maximumBit的交換群,運算子為XOR。 [Python code請進]
-
Python C++使用字串find迴圈速解Leetcode 2490 Circular Sentence C++ & Python都有字串的find,用法都類似 split=s.find(' ', split+1)能找到s從index=split+1開...
41 則留言:
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("小月"); }
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("小月");
}
}
}
}
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天"); } } } }
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天
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("二月");
}
}
}
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
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"); } } }<
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("錯誤");
}
}
}
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("錯誤");
}
}
}
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("錯誤");
}
}
}
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("錯誤");
}
}
}
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("錯誤");
}
}
}
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;
}
}
}
}
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; } } }}
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("錯誤");
}
}
}
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;
}
}
}
}
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
大月
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;
}
}
}
}
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
小月
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;
}
}
}
}
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("小月"); } } }
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("錯誤");
}
}
}
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("錯誤");
}
}
}
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; } } }}
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; } }
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;
}
}
}
}
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("小月");
}
}
}
}
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; } }
}
}
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("小月");
}
}
}
}
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("小月");
}
}
}
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("小月");
}
}
}
}
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("小月");
}
}
}
}
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("小月");
}
}
}
}
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("小月");
}
}
}
}
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;
}
}
}
}
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
小月
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天"); } } } }
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
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"); } } }
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("小月"); } } }
}
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; } } }
張貼留言