Skip to content
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
Binary file added .DS_Store
Binary file not shown.
Binary file added golang-basic/.DS_Store
Binary file not shown.
25 changes: 25 additions & 0 deletions golang-basic/latihan/01-kardiwan.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package main

import "fmt"

func main() {

var str string

fmt.Scan(&str)

result := isPalindrome(str)

fmt.Println(result)

}

func isPalindrome(str string) bool {
for i := 0; i < len(str); i++ {
j := len(str) - 1 - i
if str[i] != str[j] {
return false
}
}
return true
}
22 changes: 22 additions & 0 deletions golang-basic/latihan/02-kardiwan.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package main

import "fmt"

func main() {

var str string

fmt.Scan(&str)

result := isVocalKonsonan(str)

fmt.Println(result)
}

func isVocalKonsonan(str string) string {
if str == "a" || str == "e" || str == "i" || str == "o" || str == "u" || str == "A" || str == "E" || str == "I" || str == "O" || str == "U" {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bisa ditambahkan terlebih dahulu kondisi lowercase atw uppercase

return "Vokal"
} else {
return "Konsonan"
}
}