Untitled

mail@pastecode.io avatar
unknown
golang
3 years ago
596 B
1
Indexable
Never
package main

import (
	"fmt"
)

// n is odd -> print 'Weird'
// n even and in {2..5} print Not Wierd
// even and in {6..20} print 'Weird'
// even and > 20, print Not Weird

//take input of a single line, an integer, n

//  1 <= n <= 100

func isWeird(n int32) {
	if n%2 == 1 {
		fmt.Println("Weird")
	}
	if n%2 == 0 && (n >= 6 && n <= 20) {
		fmt.Println("Weird")
	}
}

func isNotWeird(n int32) {
	if n%2 == 0 && (n <= 2 && n <= 5) {
		fmt.Println("Not Wierd")
	}
	if n%2 == 0 && n > 20 {
		fmt.Println("Not Weird")
	}
}

func main() {

	var n int32
	fmt.Scan(&n)

	isWeird(n)
	isNotWeird(n)

}