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. Electricity Bill
  9. Even or Odd
  10. Even Numbers from 1 to N
  11. Factors of a Number
  12. Factorial of a Number
  13. First Digit of a Number
  14. Generic Root of a Number
  15. Largest of Two Numbers
  16. Largest of Three Numbers
  17. Leap year
  18. Multiplication Table
  19. Natural Numbers from 1 to N
  20. Natural Numbers in Reverse Order
  21. NCR Factorial of a Number
  22. Number divisible by 5 and 11
  23. Odd Numbers 1 to N
  24. Palindrome Number
  25. Perfect Number
  26. Prime Number
  27. Product of Digits in a Number
  28. Positive or Negative
  29. Power of a Number
  30. Profit or Loss
  31. Print 1 to 100
  32. Print 1 to 100 without using loop
  33. Reverse a Number
  34. Roots of a Quadratic Equation
  35. Simple Interest
  36. Square of a Number
  37. Square root of a Number
  38. Sum and Average of Natural Numbers
  39. Sum of Digits in a Number
  40. Sum of Even Numbers
  41. Sum of Even and Odd Numbers
  42. Sum of Odd Numbers
  43. Swap Two Numbers

Go Array Program

The list of Golang programs on one dimensional Array.

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

Go Program on Matrix

These are some of the Matrix programs in Golang.

  1. Add Two Matrices
  2. Arithmetic Operations on Matrix
  3. Determinant of a Matrix
  4. Identity Matrix
  5. Interchange Matrix Diagonals
  6. Matrix Lower Triangle
  7. Matrix Multiplication
  8. Matrix Upper Triangle
  9. Print Matrix Items
  10. Scalar Matrix Multiplication
  11. Sparse Matrix
  12. Sum of Each Matrix Column
  13. Sum of Each Matrix Row
  14. Sum of Each Row and Column of a Matrix
  15. Sum of Matrix Diagonal
  16. Sum of Matrix Lower Triangle
  17. Sum of Matrix Opposite Diagonal
  18. Sum of Matrix Upper Triangle
  19. Symmetric Matrix
  20. Transpose a Matrix
  21. 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. Print Alphabets from A to Z
  11. 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. Volume and Surface Area of a Cone
  2. Volume and Surface Area of a Cube
  3. Surface Area and Volume of a Cuboid
  4. Volume and Surface Area of a Cylinder
  5. Volume and Surface Area of a Sphere

Go Pattern Programs

  1. Box Number Pattern of 1 and 0
  2. Exponentially Increased Star Pattern
  3. Floyd’s Triangle
  4. Hollow Box Number Pattern
  5. Hollow Rectangle Star Pattern
  6. Hollow Square Star Pattern
  7. Inverted Pyramid Star Pattern
  8. Inverted Right Triangle Number Pattern
  9. Inverted Right Triangle Star Pattern
  10. Mirrored Right Triangle Pattern
  11. Print 1 and 0 in Alternative Columns
  12. Print 1 and 0 in Alternative Rows
  13. Pyramid Star Pattern
  14. Rectangle Number Pattern
  15. Rectangle Star Pattern
  16. Reversed Mirrored Right Triangle Pattern
  17. Right Angled Triangle Number Pattern
  18. Right Angled Triangle Star Pattern
  19. Square Number Pattern
  20. Square Star Pattern