Added some racket and go
This commit is contained in:
parent
2e1fff90e8
commit
2a69b3160c
46
go/fizzbuzz/main.go
Normal file
46
go/fizzbuzz/main.go
Normal file
@ -0,0 +1,46 @@
|
||||
package main
|
||||
|
||||
/*Fizz buzz
|
||||
Fiz on divisable on 3, buzz on divisable on 5, and fizbuzz if divisiable by both.
|
||||
*/
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
|
||||
//For Version
|
||||
/* for num := 1; num < 101; num++ {
|
||||
|
||||
if num%3 == 0 && num%5 != 0 {
|
||||
fmt.Println(num, " ", "fizz")
|
||||
} else if (num%5 == 0) && (num%3 != 0) {
|
||||
fmt.Println(num, " ", "buzz")
|
||||
} else if num%5 == 0 && num%3 == 0 {
|
||||
fmt.Println(num, " ", "fizzbuzz!!!")
|
||||
} else {
|
||||
fmt.Println(num)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//recursive version
|
||||
fizzBuzz(1, 100)
|
||||
}
|
||||
|
||||
func fizzBuzz(small, big int) {
|
||||
if small > big {
|
||||
return
|
||||
}
|
||||
|
||||
if small%3 == 0 && small%5 != 0 {
|
||||
fmt.Println(small, " ", "fizz")
|
||||
} else if (small%5 == 0) && (small%3 != 0) {
|
||||
fmt.Println(small, " ", "buzz")
|
||||
} else if small%5 == 0 && small%3 == 0 {
|
||||
fmt.Println(small, " ", "fizzbuzz!!!")
|
||||
} else {
|
||||
fmt.Println(small)
|
||||
}
|
||||
fizzBuzz(small+1, big)
|
||||
|
||||
}
|
14
go/fizzbuzz/test.go
Normal file
14
go/fizzbuzz/test.go
Normal file
@ -0,0 +1,14 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
var a int = 100
|
||||
|
||||
if a < 20 {
|
||||
fmt.Printf("a is less than 20\n")
|
||||
} else {
|
||||
fmt.Printf("a is not less than 20\n")
|
||||
}
|
||||
fmt.Printf("value of a is : %d\n", a)
|
||||
}
|
14
racket/first_practice/fuck.rkt
Normal file
14
racket/first_practice/fuck.rkt
Normal file
@ -0,0 +1,14 @@
|
||||
#lang racket/gui
|
||||
(require racket/gui/base)
|
||||
|
||||
(define frame (new frame% [label "Example"]))
|
||||
|
||||
(define msg (new message% [parent frame]
|
||||
[label "No events so far..."]))
|
||||
|
||||
(new button% [parent frame]
|
||||
[label "Click Me"]
|
||||
[callback (lambda (button event)
|
||||
(send msg set-label "Button click"))])
|
||||
|
||||
(send frame show #t)
|
17
racket/first_practice/hello-world-client.rkt
Normal file
17
racket/first_practice/hello-world-client.rkt
Normal file
@ -0,0 +1,17 @@
|
||||
#lang racket
|
||||
(require net/zmq)
|
||||
|
||||
(define ctxt (context 1))
|
||||
(define sock (socket ctx `REQ))
|
||||
|
||||
(printf "Connecting to hello world server...\n")
|
||||
(socket-connect! sock "tcp://localhost:5555")
|
||||
|
||||
(for ([request (in-range 10)])
|
||||
(printf "Sending request ~a...\n" request)
|
||||
(socket-send! sock #"Hello")
|
||||
|
||||
(define message (socket-recv! sock))
|
||||
(printf "Received reply ~a [~a]\n" request message))
|
||||
|
||||
(context-close! ctxt)
|
3
racket/first_practice/hello-world.rkt
Normal file
3
racket/first_practice/hello-world.rkt
Normal file
@ -0,0 +1,3 @@
|
||||
#lang racket
|
||||
|
||||
(display "Hello Justin you faggot!!!\n")
|
Loading…
x
Reference in New Issue
Block a user