-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1316d1d
commit ad4871a
Showing
9 changed files
with
309 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "1c887c75", | ||
"metadata": {}, | ||
"source": [ | ||
"### Scanner" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 13, | ||
"id": "ce81651c", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"stdin:1 2 3\n", | ||
"Angka pertama: 1\n", | ||
"Angka kedua: 2\n", | ||
"Angka ketiga: 3\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import java.util.Scanner\n", | ||
"\n", | ||
"val scan = Scanner(System.`in`)\n", | ||
"val a = scan.next().trim().toInt()\n", | ||
"val b = scan.next().trim().toInt()\n", | ||
"val c = scan.next().trim().toInt()\n", | ||
"\n", | ||
"println(\"Angka pertama: $a\")\n", | ||
"println(\"Angka kedua: $b\")\n", | ||
"println(\"Angka ketiga: $c\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "0d76f97c", | ||
"metadata": {}, | ||
"source": [ | ||
"### Output Formatting" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 18, | ||
"id": "ac70f985", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"================================\n", | ||
"stdin:Apel 2 Semangka 3 Jambu 4\n", | ||
": Apel 002\n", | ||
": Semangka 003\n", | ||
": Jambu 004\n", | ||
"================================\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"val sc = Scanner(System.`in`)\n", | ||
"println(\"================================\")\n", | ||
"for (i in 0..2) {\n", | ||
" val key: String = sc.next()\n", | ||
" val value: Int = sc.nextInt()\n", | ||
" System.out.printf(\"%-15s : %03d\\n\", key, value)\n", | ||
"}\n", | ||
"println(\"================================\")\n", | ||
"sc.close()\n", | ||
"\n", | ||
"//Input: Apel 2 Semangka 3 Jambu 4" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Kotlin", | ||
"language": "kotlin", | ||
"name": "kotlin" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": "text/x-kotlin", | ||
"file_extension": ".kt", | ||
"mimetype": "text/x-kotlin", | ||
"name": "kotlin", | ||
"nbconvert_exporter": "", | ||
"pygments_lexer": "kotlin", | ||
"version": "1.6.20-dev-5432" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c1de3f75", | ||
"metadata": {}, | ||
"source": [ | ||
"### Scanner" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 13, | ||
"id": "af5d9b62", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"stdin:1 2 3\n", | ||
"Angka pertama: 1\n", | ||
"Angka kedua: 2\n", | ||
"Angka ketiga: 3\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import java.util.Scanner\n", | ||
"\n", | ||
"val scan = Scanner(System.`in`)\n", | ||
"val a = scan.next().trim().toInt()\n", | ||
"val b = scan.next().trim().toInt()\n", | ||
"val c = scan.next().trim().toInt()\n", | ||
"\n", | ||
"println(\"Angka pertama: $a\")\n", | ||
"println(\"Angka kedua: $b\")\n", | ||
"println(\"Angka ketiga: $c\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "f42199cd", | ||
"metadata": {}, | ||
"source": [ | ||
"### Output Formatting" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 19, | ||
"id": "6d54bf9f", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"================================\n", | ||
"stdin:Apel 2 Semangka 3 Jambu 4\n", | ||
"Apel : 002\n", | ||
"Semangka : 003\n", | ||
"Jambu : 004\n", | ||
"================================\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"val sc = Scanner(System.`in`)\n", | ||
"println(\"================================\")\n", | ||
"for (i in 0..2) {\n", | ||
" val key: String = sc.next()\n", | ||
" val value: Int = sc.nextInt()\n", | ||
" System.out.printf(\"%-15s : %03d\\n\", key, value)\n", | ||
"}\n", | ||
"println(\"================================\")\n", | ||
"sc.close()\n", | ||
"\n", | ||
"//Input: Apel 2 Semangka 3 Jambu 4" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Kotlin", | ||
"language": "kotlin", | ||
"name": "kotlin" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": "text/x-kotlin", | ||
"file_extension": ".kt", | ||
"mimetype": "text/x-kotlin", | ||
"name": "kotlin", | ||
"nbconvert_exporter": "", | ||
"pygments_lexer": "kotlin", | ||
"version": "1.6.20-dev-5432" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |