Skip to content

Instantly share code, notes, and snippets.

@underhilllabs
Created January 16, 2018 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save underhilllabs/90f20b875f22a3ce63bf717fa15f3f6d to your computer and use it in GitHub Desktop.
Save underhilllabs/90f20b875f22a3ce63bf717fa15f3f6d to your computer and use it in GitHub Desktop.
fizzbuzz ruby
1.upto(100).each do |n|
print "fizz" if n % 3 == 0
print "buzz" if n % 5 == 0
print n if (n % 3 != 0 && n % 5 != 0)
end
@underhilllabs
Copy link
Author

package main

import (
	"fmt"
)

func main() {
	for i := 1; i <= 100; i++ {
		if(i % 3 == 0) {
			fmt.Print("fizz")
		}
		if(i % 5 == 0) {
			fmt.Print("buzz")
		}
		if(i % 3 != 0 && i % 5 != 0) {
			fmt.Print(i)
		}
		fmt.Println()
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment