Skip to content
Merged
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
25 changes: 25 additions & 0 deletions challenge-1/submissions/Kesha005/solution-template.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package main

import (
"fmt"
)

func main() {
var a, b int
// Read two integers from standard input
_, err := fmt.Scanf("%d, %d", &a, &b)
if err != nil {
fmt.Println("Error reading input:", err)
return
}

// Call the Sum function and print the result
result := Sum(a, b)
fmt.Println(result)
}

// Sum returns the sum of a and b.
func Sum(a int, b int) int {

return a +b
}
41 changes: 41 additions & 0 deletions challenge-18/submissions/Kesha005/solution-template.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package main

import (
"fmt"
"math"
)

func main() {
// Example usage
celsius := 25.0
fahrenheit := CelsiusToFahrenheit(celsius)
fmt.Printf("%.2f°C is equal to %.2f°F\n", celsius, fahrenheit)

fahrenheit = 68.0
celsius = FahrenheitToCelsius(fahrenheit)
fmt.Printf("%.2f°F is equal to %.2f°C\n", fahrenheit, celsius)
}

// CelsiusToFahrenheit converts a temperature from Celsius to Fahrenheit
// Formula: F = C × 9/5 + 32
func CelsiusToFahrenheit(celsius float64) float64 {
// TODO: Implement this function
// Remember to round to 2 decimal places
f := celsius *9/5+32

return Round(f,2)
}

// FahrenheitToCelsius converts a temperature from Fahrenheit to Celsius
// Formula: C = (F - 32) × 5/9
func FahrenheitToCelsius(fahrenheit float64) float64 {
c := (fahrenheit-32)*5/9

return Round(c,2)
}

// Round rounds a float64 value to the specified number of decimal places
func Round(value float64, decimals int) float64 {
precision := math.Pow10(decimals)
return math.Round(value*precision) / precision
}
35 changes: 35 additions & 0 deletions challenge-2/submissions/Kesha005/solution-template.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package main

import (
"bufio"
"fmt"
"os"
)

func main() {
// Read input from standard input
scanner := bufio.NewScanner(os.Stdin)
if scanner.Scan() {
input := scanner.Text()

// Call the ReverseString function
output := ReverseString(input)

// Print the result
fmt.Println(output)
}
}

// ReverseString returns the reversed string of s.
func ReverseString(s string) string {
runes := []rune(s)


for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
runes[i], runes[j] = runes[j], runes[i]
}


return string(runes)

}
Loading