Quick actions

cmd+k|ctrl+k

Navigation

Languages

screen ratio calculation chairul umam

Snippet info

Language

Groovy

Visibility

public

Author

orochi-100

Created

2022-02-04T12:04:24.924947Z

Updated

2022-02-04T12:07:27.676459Z

def (a, b) = ratio 1920, 1080

println "$a:$b"

def ratio(height, width) {
    def gcd = gcd height, width
    height > width ? [height / gcd, width / gcd] : [width / gcd, height / gcd]
}

def gcd(p, q) { q == 0 ? p : gcd(q, p % q) }
INFO