Go Programs

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.

  1. Golang Program to Print Hello World
  2. Go Program to add Two Numbers
  3. Go Program to Find the Compound Interest
  4. Go Program to Count Digits in a Number
  5. Go Program to Count Total Notes in an Amount
  6. Go Program to Find the Cube of a Number
  7. Go Program to Calculate the Employee Salary
  8. Go Program to calculate Electricity Bill
  9. Go Program to check Even or Odd
  10. Go Program to print Even Numbers from 1 to N
  11. Go Program to find Factors of a Number
  12. Go Program to find Factorial of a Number
  13. Go Program to find First Digit of a Number
  14. Go Program to find Generic Root of a Number
  15. Go Program to check Largest of Two Numbers
  16. Go Program to check Largest of Three Numbers
  17. Go Program to check Leap year
  18. Go Program to print Multiplication Table
  19. Go Program to print Natural Numbers from 1 to N
  20. Go Program to print Natural Numbers in Reverse Order
  21. Go Program to find NCR Factorial of a Number
  22. Go Program to find Number divisible by 5 and 11
  23. Go Program to print Odd Numbers 1 to N
  24. Go Program to check Palindrome Number
  25. Go Program to check Perfect Number
  26. Go Program to check Prime Number
  27. Go Program to find Product of Digits in a Number
  28. Go Program to check Positive or Negative
  29. Go Program to Calculate Power of a Number
  30. Go Program to Calculate Profit or Loss
  31. Go Program to Print 1 to 100
  32. Go Program to Print 1 to 100 without using loop
  33. Go Program to Reverse a Number
  34. Go Program to find Roots of a Quadratic Equation
  35. Go Program to Calculate Simple Interest
  36. Go Program to Calculate Square of a Number
  37. Go Program to find Square root of a Number
  38. Go Program to find Sum and Average of Natural Numbers
  39. Go Program to find Sum of Digits in a Number
  40. Go Program to find Sum of Even Numbers
  41. Go Program to find Sum of Even and Odd Numbers
  42. Go Program to find Sum of Odd Numbers
  43. Go Program to Swap Two Numbers

Go Array Program

The list of Golang programs on one dimensional Array.

  1. Go Program to Add Two Arrays
  2. Go Program to perform Arithmetic Operations on an Array
  3. Go Program to perform Array Multiplication
  4. Go Program to Calculate Array Average
  5. Go Program to Count Duplicates in an Array
  6. Go Program to Count Even and Odd Numbers in an Array
  7. Go Program to Count Positive and Negative Numbers in an Array
  8. Go Program to find Largest Array Item
  9. Go Program to find Largest and Smallest Number in an Array
  10. Go Program to Print Array Items
  11. Go Program to Print Array Items in Even Index Position
  12. Go Program to Print Array Items in Odd Index Position
  13. Go Program to Print Even Numbers in an Array
  14. Go Program to Print Negative Numbers in an Array
  15. Go Program to Print Odd Numbers in an Array
  16. Go Program to Print Positive Numbers in an Array
  17. Go Program to Put Positive and Negatives in a Separate Array
  18. Go Program to Reverse an Array
  19. Go Program to Search for Array Items
  20. Go Program to find Smallest Array Item
  21. Go Program to find Sum of Array Items

Go Program on Matrix

These are some of the Matrix programs in Golang.

  1. Go Program to Add Two Matrices
  2. Go Program to perform Arithmetic Operations on Matrix
  3. Go Program to find Determinant of a Matrix
  4. Go Program to check Identity Matrix
  5. Go Program to Interchange Matrix Diagonals
  6. Go Program to print Matrix Lower Triangle
  7. Go Program to perform Matrix Multiplication
  8. Go Program to print Matrix Upper Triangle
  9. Go Program to Print Matrix Items
  10. Go Program to Calculate Scalar Matrix Multiplication
  11. Go Program to check Sparse Matrix
  12. Go Program to find Sum of Each Matrix Column
  13. Go Program to find Sum of Each Matrix Row
  14. Go Program to find Sum of Each Row and Column of a Matrix
  15. Go Program to find Sum of Matrix Diagonal
  16. Go Program to find Sum of Matrix Lower Triangle
  17. Go Program to find Sum of Matrix Opposite Diagonal
  18. Go Program to find Sum of Matrix Upper Triangle
  19. Go Program to check Symmetric Matrix
  20. Go Program to Transpose a Matrix
  21. Go Program to check Two Matrixes are Equal

Go String Programs

The following are list of Golang programs to work with Strings.

  1. ASCII value of String Characters
  2. Concat Two String
  3. Convert Byte to String
  4. Convert String to Byte Array
  5. First Character in a String
  6. Last Character in a String
  7. Print String Characters
  8. String Length

Go Character Programs

In these Go example programs, we use both the Rune and the byte variables to represent the characters.

  1. Alphabet or Not
  2. ASCII Value of a Character
  3. ASCII Values of All Characters
  4. Check Character is a Lowercase
  5. Check Character is an Uppercase
  6. Convert Lowercase Character to Uppercase
  7. Convert Uppercase Character to Lowercase
  8. Digit or Not
  9. Print Alphabets from a to z
  10. Golang Program to Print Alphabets from A to Z
  11. Golang Program to 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.

  1. Golang Program to find Volume and Surface Area of a Cone
  2. Golang Program to find Volume and Surface Area of a Cube
  3. Golang Program to find Surface Area and Volume of a Cuboid
  4. Golang Program to find Volume and Surface Area of a Cylinder
  5. Golang Program to find Volume and Surface Area of a Sphere

Go Number Pattern Programs

  1. Go Program to print Box Number Pattern of 1 and 0
  2. Go Program to print Hollow Box Number Pattern
  3. Go Program to Print 1 and 0 in Alternative Columns
  4. Go Program to Print 1 and 0 in Alternative Rows
  5. Go Program to Print Diamond Number Pattern
  6. Go Program to print Floyd’s Triangle
  7. Go Program to Print K Shape Number Pattern
  8. Go Program to Print Left Pascals Number Triangle
  9. Go Program to print Rectangle Number Pattern
  10. Go Program to print Right Angled Triangle Number Pattern
  11. Go Program to Print Right Angled Triangle of 1 and 0
  12. Go Program to Print Right Angled Triangle of Consecutive Column Numbers
  13. Go Program to Print Right Angled Triangle of Consecutive Rows Numbers
  14. Go Program to Print Right Angled Triangle of Incremented Numbers
  15. Go Program to Print Right Angled Triangle of Numbers in Reverse
  16. Go Program to Print Right Angled Triangle of Same Column Numbers
  17. Go Program to print Inverted Right Triangle Number Pattern
  18. Go Program to Print Inverted Right Triangle of Column Numbers in Reverse
  19. Go Program to Print Inverted Right Triangle of Consecutive Column Numbers
  20. Go Program to Print Inverted Right Triangle of Descending Order Numbers
  21. Go Program to Print Inverted Right Triangle of Same Column Numbers
  22. Go Program to Print Pascal Triangle
  23. Go Program to Print Right Pascals Number Triangle
  24. Go Program to Print Right Arrow Number Pattern
  25. Go Program to print Square Number Pattern
  26. Go Program to Print Same Numbers on all Sides of a Square
  27. Go Program to Print Same Numbers in Square Rows and Columns
  28. Go Program to Print Simple Number Pattern
  29. Go program to Print Sandglass Number Pattern

Go Star and Alphabets Pattern Programs

  1. Go Program to Print Diamond Star Pattern
  2. Go Program to Print Hollow Diamond Star Pattern
  3. Go Program to Print Hollow Diamond inside a Square Star Pattern
  4. Go Program to Print Right Half Diamond Star Pattern
  5. Go Program to Print Mirrored Half Diamond Star Pattern
  6. Go Program to Print Downward Triangle Star Pattern
  7. Go Program to print Exponentially Increased Star Pattern
  8. Go Program to print Inverted Pyramid Star Pattern
  9. Go Program to print Inverted Right Triangle Star Pattern
  10. Go Program to Print Hollow Inverted Right Triangle Star Pattern
  11. Go Program to Print Reverse Mirrored Right Triangle Star Pattern
  12. Go Program to print Pyramid Star Pattern
  13. Go Program to Print Hollow Star Pyramid Pattern
  14. Go Program to Print Hollow Inverted Star Pyramid Pattern
  15. Go Program to Print Left Pascals Star Triangle
  16. Go Program to Print Hollow Left Pascals Star Triangle
  17. Go Program to Print Right Pascals Star Triangle
  18. Go Program to Print Hollow Right Pascals Star Triangle
  19. Go Program to print Rectangle Star Pattern
  20. Go Program to print Hollow Rectangle Star Pattern
  21. Go Program to Print Rhombus Star Pattern
  22. Go Program to Print Hollow Rhombus Star Pattern
  23. Go Program to Print Mirrored Rhombus Star Pattern
  24. Go Program to Print Hollow Mirrored Rhombus Star Pattern
  25. Go Program to Print Hollow Right Angled Triangle Star Pattern
  26. Go Program to print Mirrored Right Angled Triangle Pattern
  27. Go Program to Print Inverted Mirrored Right Angled Triangle Star Pattern
  28. Go Program to print Reversed Mirrored Right Angled Triangle Pattern
  29. Go Program to Print Left Arrow Star Pattern
  30. Go Program to Print Right Arrow Star Pattern
  31. Go Program to print Square Star Pattern
  32. Go Program to print Hollow Square Star Pattern
  33. Go Program to Print Hollow Square with Diagonals Star Pattern
  34. Go program to Print Sandglass Star Pattern
  35. Go Program to Print Plus Star Pattern
  36. Go Program to Print X Star Pattern
  37. Go Program to Print K Shape Alphabets Pattern
  38. Go Program to Print Repeated Characters Pattern
  39. Go Program to Print Right Triangle Alphabets Pattern
  40. Go Program to Print Triangle Alphabets Pattern