The following is the list of Go programming examples or Go programs that help you practice at your lab. We categorically divided this page into different sections, and each section has a different set of Go programs.
All the Go programs that we mentioned here have the program code along with the execution result. However, we haven’t explained the step-wise analysis because we already did in C programs and Python Programs. To make it simple, we have given the same names to these Go examples. I suggest you refer to C or Python programs to understand the analysis part (if needed).
Basic Go programs
The following are the basic and advanced Golang programs on Numbers and conditional statements.
- Golang Program to Print Hello World
- Go Program to add Two Numbers
- Go Program to Find the Compound Interest
- Go Program to Count Digits in a Number
- Go Program to Count Total Notes in an Amount
- Go Program to Find the Cube of a Number
- Go Program to Calculate the Employee Salary
- Go Program to calculate Electricity Bill
- Go Program to check Even or Odd
- Go Program to print Even Numbers from 1 to N
- Go Program to find Factors of a Number
- Go Program to find Factorial of a Number
- Go Program to find First Digit of a Number
- Go Program to find Generic Root of a Number
- Go Program to check Largest of Two Numbers
- Go Program to check Largest of Three Numbers
- Go Program to check Leap year
- Go Program to print Multiplication Table
- Go Program to print Natural Numbers from 1 to N
- Go Program to print Natural Numbers in Reverse Order
- Go Program to find NCR Factorial of a Number
- Go Program to find Number divisible by 5 and 11
- Go Program to print Odd Numbers 1 to N
- Go Program to find Product of Digits in a Number
- Check Palindrome Number
- Check Perfect Number
- Check Prime Number
- Check Positive or Negative
- Calculate Power of a Number
- Calculate Profit or Loss
- Print 1 to 100
- Print 1 to 100 without using loop
- Reverse a Number
- Roots of a Quadratic Equation
- Simple Interest
- Square of a Number
- Square root of a Number
- Sum and Average of Natural Numbers
- Sum of Digits in a Number
- Sum of Even Numbers
- Sum of Even and Odd Numbers
- Sum of Odd Numbers
- Swap Two Numbers
Go Array Program
The list of Golang programs on one dimensional Array.
- Add Two Arrays
- Arithmetic Operations on an Array
- Multiplication
- Calculate Array Average
- Count Duplicates in an Array
- Count Even and Odd Numbers in an Array
- Count Positive and Negative Numbers in an Array
- Largest Array Item
- Largest and Smallest Number in an Array
- Print Array Items
- Print Array Items in Even Index Position
- Print Array Items in Odd Index Position
- Print Even Numbers in an Array
- Print Negative Numbers in an Array
- Print Odd Numbers in an Array
- Print Positive Numbers in an Array
- Put Positive and Negatives in a Separate Array
- Reverse an Array
- Search for Array Items
- Smallest Array Item
- Sum of Array Items
Go Program on Matrix
These are some of the Matrix programs in Golang.
- Add Two Matrices
- Arithmetic Operations on Matrix
- Determinant of a Matrix
- Identity Matrix
- Interchange Matrix Diagonals
- Matrix Lower Triangle
- Matrix Multiplication
- Matrix Upper Triangle
- Print Matrix Items
- Scalar Matrix Multiplication
- Sparse Matrix
- Sum of Each Matrix Column
- Sum of Each Matrix Row
- Sum of Each Row and Column of a Matrix
- Sum of Matrix Diagonal
- Sum of Matrix Lower Triangle
- Sum of Matrix Opposite Diagonal
- Sum of Matrix Upper Triangle
- Symmetric Matrix
- Transpose a Matrix
- Check Two Matrixes are Equal
Go String Programs
The following are list of Golang programs to work with Strings.
- ASCII value of String Characters
- Concat Two String
- Convert Byte to String
- Convert String to Byte Array
- Find First Character in a String
- Find Last Character in a String
- Print String Characters
- String Length
Go Character Programs
In these Go example programs, we use both the Rune and the byte variables to represent the characters.
- Alphabet or Not
- ASCII Value of a Character
- Print ASCII Values of All Characters
- Check Character is a Lowercase
- Check Character is an Uppercase
- Convert Lowercase Character to Uppercase
- Convert Uppercase Character to Lowercase
- Check Digit or Not
- Print Alphabets from a to z
- Print Alphabets from A to Z
- Check Vowel or Consonant
Golang Volume and Surface Area Programs
The following Go examples will find and return the volume, surface area, and lateral surface area of different shapes.
- Golang Program to find Volume and Surface Area of a Cone
- Golang Program to find Volume and Surface Area of a Cube
- Golang Program to find Surface Area and Volume of a Cuboid
- Golang Program to find Volume and Surface Area of a Cylinder
- Golang Program to find Volume and Surface Area of a Sphere
Go Number Pattern Programs
- Box Number Pattern of 1 and 0
- Hollow Box Number Pattern
- 1 and 0 in Alternative Columns
- 1 and 0 in Alternative Rows
- Diamond Number Pattern
- Floyd’s Triangle
- K Shape Number Pattern
- Left Pascals Number Triangle
- Rectangle Number Pattern
- Right Angled Triangle Number Pattern
- Right Angled Triangle of 1 and 0
- Right Angled Triangle of Consecutive Column Numbers
- Right Angled Triangle of Consecutive Rows Numbers
- Right Angled Triangle of Incremented Numbers
- Right Angled Triangle of Numbers in Reverse
- Right Angled Triangle of Same Column Numbers
- Inverted Right Triangle Number Pattern
- Inverted Right Triangle of Column Numbers in Reverse
- Inverted Right Triangle of Consecutive Column Numbers
- Inverted Right Triangle of Descending Order Numbers
- Inverted Right Triangle of Same Column Numbers
- Pascal Triangle
- Right Pascals Number Triangle
- Right Arrow Number Pattern
- Square Number Pattern
- Same Numbers on all Sides of a Square
- Same Numbers in Square Rows and Columns
- Simple Number Pattern
- Sandglass Number Pattern
Go Star and Alphabets Pattern Programs
- Diamond Star Pattern
- Hollow Diamond Star Pattern
- Hollow Diamond inside a Square Star Pattern
- Right Half Diamond Star Pattern
- Mirrored Half Diamond Star Pattern
- Downward Triangle Star Pattern
- Exponentially Increased Star Pattern
- Inverted Pyramid Star Pattern
- Inverted Right Triangle Star Pattern
- Hollow Inverted Right Triangle Star Pattern
- Reverse Mirrored Right Triangle Star Pattern
- Pyramid Star Pattern
- Hollow Star Pyramid Pattern
- Hollow Inverted Star Pyramid Pattern
- Left Pascals Star Triangle
- Hollow Left Pascals Star Triangle
- Right Pascals Star Triangle
- Hollow Right Pascals Star Triangle
- Rectangle Star Pattern
- Hollow Rectangle Star Pattern
- Rhombus Star Pattern
- Hollow Rhombus Star Pattern
- Mirrored Rhombus Star Pattern
- Hollow Mirrored Rhombus Star Pattern
- Hollow Right Angled Triangle Star Pattern
- Mirrored Right Angled Triangle Pattern
- Inverted Mirrored Right Angled Triangle Star Pattern
- Reversed Mirrored Right Angled Triangle Pattern
- Left Arrow Star Pattern
- Right Arrow Star Pattern
- Right Angled Triangle Star Pattern
- Square Star Pattern
- Hollow Square Star Pattern
- Hollow Square with Diagonals Star Pattern
- Sandglass Star Pattern
- Plus Star Pattern
- X Star Pattern
- K Shape Alphabets Pattern
- Repeated Characters Pattern
- Right Triangle Alphabets Pattern
- Triangle Alphabets Pattern