Write a Go program to find the largest number in an array.
EasyProblem Statement
Write a Go program to find the largest number in an array.
Sample Input
An array of integers (e.g., [10, 20, 5, 15]).
Sample Output
20
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
package main
import "fmt"
func findLargest(arr []int) int {
// Write code to find the largest number in the array
return 0
}
func main() {
arr := []int{10, 20, 5, 15}
fmt.Println(findLargest(arr))
}
Input
An array of integers (e.g., [10, 20, 5, 15]).
Expected Output
20