Last active
August 4, 2022 07:44
-
-
Save xenowits/502566a1ac2b778b9afae04aa068282a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [rust] run with `rustc main.rs && ./main` | |
fn main() { | |
for n in 4..20 { | |
let t = (2*n) as f64 / 3 as f64; | |
println!("{} of {}", t.ceil(), n); | |
} | |
} | |
// [javascript] run with `node main.js` | |
const fn = () => { | |
for (let n = 4; n < 20; n++) { | |
let t = parseInt(Math.ceil((2 * n) / 3)); | |
console.log(t, "of", n); | |
} | |
}; | |
fn(); | |
// [go] run with `go run main.go` | |
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func main() { | |
for n := 4; n < 20; n++ { | |
fmt.Println(int(math.Ceil(float64(2*n)/3)), "of", n) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment