using system;
using system.collections.generic;
using system.linq;
using system.text;
using system.threading.tasks;
//「你有能力嗎?」有,「先賺錢,再買房,再結婚吧!」,沒有,「拜拜!」
console.writeline("你有房子嗎?");
string huida = console.readline();//因為回答不是乙個數字,需要string定義
if (huida == "有")
else//沒有
else//沒有
else //沒有
}conso.readline();
//分別輸入月份 幾號 輸出是今年的第多少天,每年的1 3 5 7 8 10 12是31天,今年的2月是28天,其他是30天
int m1 = 31, m2 = 28, m3 = 31, m4 = 30, m5 = 31, m6 = 30, m7 = 31, m8 = 31, m9 = 30, m10 = 31, m11 = 30;
//分別定義個個月的天數
console.write("請輸入月份:");
int yf = int.parse(console.readline());
console.write("請輸入幾號:");
int h = int.parse(console.readline());//輸入日期,賦值到h,
switch (yf)//排列每個月份,
console.readline();
//輸入年,月,日,判斷格式是否正確
console.write("請輸入年份:");
int year = int.parse(console.readline());
//判斷年份是否正確
if (year >= 0 && year <= 9999) //年份正確
else
}else if (yf == 4 || yf == 6 || yf == 9 || yf == 11)//輸入的是小月
else
}else if (yf == 2) //輸入的是二月,需要判斷平年還是閏年
else//日期輸入有誤
}else//說明不是閏年
else//日期輸入有誤}}
}else
}else//年份輸入有誤
Java 條件語句 迴圈語句練習
題目一 一張紙的厚度大約是0.08mm,對折多少次之後能達到珠穆朗瑪峰的高度 8848.13公尺 double height 0.08 for int i 1 i 0 i 題目二 計算5的階乘 5 的結果是?int sum 1 for int i 1 i 5 i system.out.println...
js 條件語句簡單練習題
1.已知兩個矩形,寬高分別是200200,400400,甲矩形的座標是x1,y1.乙矩形的座標是x2,y2.寫出判斷條件兩個矩形是否相碰撞 x1 200 自己隨意定義座標 x2 200 y1 400 y2 400 var bool false 先定義乙個布林值為false if x1 x2 x1 x...
繼續for迴圈和條件語句的練習
我用的是類似於數學計算的思想寫的,應該有其他更大牛一點的方法,後面遇到了我會在總結一下。define crt secure no warnings 1 includeint main for j 1 j 2 i 1 j printf n for i 1 i n 1 i for j 1 j 2 m i...