Go Programs with Output

Welcome to our collection of 40+ Golang (Go) programs with output, organized into 6 topic-wise sections. Each program is explained in its own blog post, with the code, comments, and sample output to help you understand the logic and execution flow.

Go is a fast, simple, and statically typed programming language developed at Google. It is widely used for cloud services, microservices, command-line tools, and DevOps tooling. Whether you are a beginner starting your Go learning journey or an experienced coder sharpening your skills, practicing these programs will also help you crack coding interviews.

What this page covers:

  • Fundamentals: basic programs and mathematical programs (Sections 1 and 2).
  • Strings and arrays: string manipulation and array operations (Sections 3 and 4).
  • Algorithms and data structures: linear and binary search, sorting algorithms, and stacks and queues (Sections 5 and 6).

How to use this page: Beginners should start with Section 1 and try to write each program on their own before reading the solution.

1. Basic Programs

Start here: your first Go program and simple arithmetic operations.

2. Mathematical Programs

Number and math programs such as prime, Armstrong, factorial, Fibonacci, GCD, and LCM.

3. String Programs

4. Array Programs

5. Searching and Sorting Algorithms

Searching

Sorting

6. Data Structure Programs

Implement data structures in Go using slices.

Comments