Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update examples #1

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
# examples
# BAIK Examples
BAIK Examples adalah kumpulan sumber daya (source code) program [BAIK](https://sourceforge.net/projects/baik/).

## Memasang

- Anda sudah menginstall bahasa [BAIK](https://sourceforge.net/projects/baik/)
- Silahkan klon repo ini, dan
- Jalankan

## Contoh sederhana
- Perulangan

```shell
isi a = 0;
ulang(a < 10){
tulis("ulang",a);
a++;
}
tulis("-------------------");
untuk(isi b=0;b < 10; b++){
tulis("untuk",b);
}
```
- Menghitung luas segitiga
```shell
# Contoh program untuk menghitung luas lingkaran
# @created Billal Fauzan

tulis "Masukan nilai alas: "
masuk var_alas
tulis "Masukan nilai tinggi: "
masuk var_tinggi

luas = (var_alas*var_tinggi)/2
tulis "Luas: ", luas, "\n"
```
File renamed without changes.
27 changes: 27 additions & 0 deletions algoritma/matematika/faktorial.ina
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
tulis "tes rekursif dgn BAIK - Faktorial\n"

tulis "Masukan nilai faktorial: "
masuk A

F = &tesFaktorial(A)
tulis "F=",F,"\n"

tulis "== selesai ==\n"

tamat

fungsi tesFaktorial(a) {
ret = 1
tulis "a start=",a,"\n"

kalau a == 1 maka
ret = 1
lainnya
b = &tesFaktorial(a - 1)
ret = a * b
akhirkalau

tulis "a end=",a,"\n"

balik ret
}
10 changes: 10 additions & 0 deletions algoritma/matematika/luas-lingkaran.ina
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Contoh program untuk menghitung luas lingkaran
# @created Billal Fauzan

PHI = 3.14

tulis "Masukan jari lingkaran: "
masuk jari

luas = PHI * jari * jari
tulis "Luas: ", luas, "\n"
10 changes: 10 additions & 0 deletions algoritma/matematika/luas-persegi-panjang.ina
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Contoh program untuk menghitung luas lingkaran
# @created Billal Fauzan

tulis "Masukan nilai panjang: "
masuk var_panjang
tulis "Masukan nilai lebar: "
masuk var_lebar

luas = var_panjang * var_lebar
tulis "Luas: ", luas, "\n"
10 changes: 10 additions & 0 deletions algoritma/matematika/luas-segitiga.ina
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Contoh program untuk menghitung luas lingkaran
# @created Billal Fauzan

tulis "Masukan nilai alas: "
masuk var_alas
tulis "Masukan nilai tinggi: "
masuk var_tinggi

luas = (var_alas*var_tinggi)/2
tulis "Luas: ", luas, "\n"
14 changes: 14 additions & 0 deletions algoritma/matematika/luas-trapesium.ina
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contoh program untuk menghitung luas lingkaran
# @created Billal Fauzan

tulis "Masukan sisi atas: "
masuk sisi_atas
tulis "Masukan sisi bawah: "
masuk sisi_bawah
tulis "Masukan nilai tinggi: "
masuk var_tinggi

luas = sisi_atas + sisi_bawah
luas = luas * var_tinggi
luas = luas / 2
tulis "Luas: ", luas, "\n"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.