Skip to content

pete314/go-basics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This repository contains basic Golang problems and solutions. The purpose of this is nothing more to learn Go trough practical examples

Problem sheet 1

  1. The natural numbers below 10 that are multiples of 3 or 5 are: 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. My solution

  2. The first six prime numbers in order are 2, 3, 5, 7, 11, and 13. So, for instance, the 4th prime number is 7. Write a program to find the 10,001st prime number. My solution

  3. Write a program that accepts a user inputted string and prints its reverse. My solution

  4. Write a program that takes as input a positive integer and applies the following operations until the sequence begins to repeat: if the number is even, divide it by 2, but if the nubmer is odd, multiply it by 3 and add 1. The program should print the generated sequence to the screen. You might want to consider whether the program always terminates, and what will happen should the program encounter a 0. My solution

  5. Write a program that accepts four characters as input, and outputs all permutations of those four characters. What should your program do if two or more of the characters are the same? My partial solution

About

Basics in golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages