Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a Go program to generate Fibonacci numbers up to a given limit using a loop.

Medium

Problem Statement

Create a Go program to generate Fibonacci numbers up to a given limit using a loop.

Sample Input

An integer n = 10.

Sample Output

[0 1 1 2 3 5 8 13 21 34]

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
package main import "fmt" func fibonacci(n int) []int { // Generate Fibonacci numbers up to the limit return nil } func main() { fmt.Println(fibonacci(10)) }
Log in or sign up to run or submit your code.Log inSign up
Input
An integer n = 10.
Expected Output
[0 1 1 2 3 5 8 13 21 34]