1から12までの整数を乱数で発生させて,その月の日数(閏年では無いときの)を 答えるプログラムを作成しましょう.
Month: 2 Days: 28 |
論理演算子 || を使いますが,なるべく条件の記述が短くなるように工夫してください.
Two numbers: 412 and 825 Sum of all digits: 7 < 15 |
各位の数字を取り出すには剰余と除算を組み合わせて行います.方法を考えてみてください.
Liverpool 0 - 1 Sanfrecce Winner: Sanfrecce Hiroshima FC |
引き分けの場合は2行目にDrawと表示させましょう.
1 | 2 | 3 | 4 | 5 | 6 | |
---|---|---|---|---|---|---|
1 | Home run! | Out... | Out... | Out... | Out... | Sigle hit! |
2 | Out... | Three base hit! | Out... | Out... | Sigle hit! | Out... |
3 | Out... | Out... | Two base hit! | Sigle hit! | Out... | Out... |
4 | Out... | Out... | Sigle hit! | Two base hit! | Out... | Out... |
5 | Out... | Sigle hit! | Out... | Out... | Two base hit! | Out... |
6 | Sigle hit! | Out... | Out... | Out... | Out... | Sigle hit! |
Dice: 6 1 Result: Single hit! |
Random number: 51 K of Clubs |
論理演算子を使用しないでプログラムしてください.
通常の場合の表示例
RGB: 011 light blue |
R | G | B | color |
---|---|---|---|
0 | 0 | 0 | black |
1 | 0 | 0 | red |
0 | 1 | 0 | light green |
0 | 0 | 1 | blue |
1 | 1 | 0 | yellow |
1 | 0 | 1 | magenta |
0 | 1 | 1 | light blue |
1 | 1 | 1 | white |