Go Assignment - 1

Welcome to the first assignment of this Go Tutorial series.

Objectives of the assignment:

  1. To revise the concepts studied till now.

  2. To have a clear understanding of the theory.

  3. Writing a working Go code.

Coding Paradigms:

  1. Use proper comments while writing your code.

  2. Use sensible variable names.

  3. Try to use the concepts studied wherever applicable.

  4. Try to take inputs from the system and not hardcode it.

  5. Always check for corner cases. Your code should run properly for any input.

How do you evaluate your assignment?

  1. Your code should compile without any error.

  2. Test your code for the test case provided in the problems.

If you want a detailed analysis of your solution(code review included), please mail your solution to aman.st.francis@gmail.com with the following details:

  1. Subject: Go Assignment -1 Solution

  2. Body: Write your name and your place of residence.

  3. Attachment: Please make sure that you send a single attachment in a zip folder titled Go_Assignment_1.zip. Place all the solutions in the folder.


  1. Write a program to check whether a given string is palindrome or not. A string is said to be palindrome if the reverse of that string is equal to the original string. Test cases: a. Input: amansinha Output: false b. Input: ABCDCBA Output: true

  2. Write a program to check whether a number is 'Armstrong' or not. A number is said to be Armstrong if and only if the sum of cubes of its digits is equal to the original number. For example, 153 is an Armstrong number as 1^3 + 5^3 + 3^3 = 153. Test cases: a. Input: 153 Output: True b. Input: 38 Output: false

  3. Write a program to print the first n Fibonacci numbers. Fibonacci numbers are a sequence of numbers starting with 1,1. The next number is the sum of the last two numbers. The series looks something like this: 1,1,2,3,5,8,13 .... Test cases: a. Input: 5 Output: 1,1,2,3,5 b. Input: 9 Output: 1,1,2,3,5,8,13,21,34

  4. Write a program to check whether a number is prime or not. A number is said to be prime if it is divisible only by 1 and the number itself. Test cases: a. Input: 3 Output: true b. Input: 6 Output: false

Please Note: Do not be disheartened if you are not able to solve any problem. We are all here to learn. Send me the best you can do, just do not cheat yourself. If you send me your best work, I could analyse that and come up with its feedback that will help you in the future. If you have any doubts regarding any question, write a mail to me with the subject: Clarification on Assignment-1 and write the problem you have in the mail body. Looking forward to your solution.



©2020 by Aman Sinha.