サマーセッション取りたい科目がありませんでした笑
みなさんご機嫌いかがでしょうか。今日も日がな一日データ構造の勉強していました。少しは身になったと信じたいところです。来週末にはテストですが8割はとりたいところです。 今日は夏休みの話題です。昨日、やっとサマーセッションの…
みなさんご機嫌いかがでしょうか。今日も日がな一日データ構造の勉強していました。少しは身になったと信じたいところです。来週末にはテストですが8割はとりたいところです。 今日は夏休みの話題です。昨日、やっとサマーセッションの…
みなさんご機嫌いかがでしょうか。今日は春休みで図書館もジムも開いていなかったので仕方なく家に閉じこもっていました。データ構造やc++の勉強を少しはできたんでよかったです。 さて、今日はサイエンスコミュニケーターのお話につ…
みなさんご機嫌いかがでしょうか。今日もまだ春休み中なので、図書館で機械学習とデータ構造の勉強してました。春休み中に図書館の正門も改装していて裏門から入るという貴重な経験をしています。 さて、今日は連日世間を騒がせている財…
みなさんご機嫌いかがでしょうか。日本は公文書ねつ造の問題でてんやわんやしているらしいですが、これを機会に公文書でブロックチェーンが活用されるといいですね。あとは、今回の件をきっかけに、公的機関でやばそうな書類はそもそも表…
みなさんご機嫌いかがでしょうか。今日は入力した整数の各桁の和を計算するために、sumDigitsを使ったコードを紹介します。まずは簡単にsumDigitについて紹介します。 sumDigitsとは? sumDigitsの…
みなさんご機嫌いかがでしょうか。今日は春休みということもあって(中国人の)友達と映画を見に行ってきました。その前にレストランにステーキを食べに行ってきたのでまずはその件についてお話します。 レストランでは付け合わせのパン…
みなさんご機嫌いかがでしょうか。今日はJavaの問題で2つの整数の比較です。この問題の肝は、if節の使い方です。今回はelse, elseifを使わずif節のみで書いてみました。 import java.util.Sca…
みなさんご機嫌いかがでしょうか。本日PC版の表示(均等割り付け)が変なことに気づいたので修正しました。ご迷惑をおかけして申し訳ございませんでした。 さて、今日は春休みにも関わらず図書館とジムが開いていたので利用してみまし…
みなさんご機嫌いかがでしょうか。今日は九九の表示のアルゴリズムを以下の通りご紹介します。java Scannerクラスを利用するためには、はじめにScannerをインポートする必要があります。(コードは右記:import…
みなさんご機嫌いかがでしょうか。今日は入力した二つの数の掛け算のプログラムを作ったので共有いたします。
1 2 |
<br /><br /><div style="padding: 20px 20px; border-color: #FF0000; border-width: 0 0 2px 15px; border-style: solid; background: #F8F8F8;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;">import java.util.Scanner;</span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;"> </span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;">public class Test {</span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;"> </span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;"> public static void main(String[] args) {</span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;"> Scanner input = new Scanner(System.in);</span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;"> </span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;"> System.out.print("一つ目の数を入力してください: ");</span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;"> int num1 = input.nextInt();</span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;"> </span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent : 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;"> System.out.print("二つ目の数を入力してください: ");</span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;"> int num2 = input.nextInt();</span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;"> </span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;"> System.out.println(num1 + " x " + num2 + " = " + num1 * num2);</span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;"> }</span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;"> </span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"><span style="text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;">}</span><br style="background: none; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-space: normal; min-height: 0px; orphans: 2; -webkit-text-stroke-width: 0px;"></div><br /> |
アウトプットは次の通りです。 一つ目…