PROBLEM 75
Medium

Two-digit Multiple of 7 — Rule 176

Go Programming Basics · Go

</>
STATUS Not solved

TASK

Problem

#75

An integer `n` is entered. Print `YES` if its absolute value is a two-digit number divisible by 7; otherwise print `NO`. In addition, `n` must not be divisible by 176.

EXAMPLE

Example

Input
14
Output
YES

LIMITS

Constraints

- Input values fit the Go types used in the reference solution.
- Print only the value(s) requested by the statement.
📖
LEARN Theory for this problem
+

`if` selects a branch from a boolean condition. Combine predicates with `&&`, `||`, and `!` only when their precedence matches the intended logic.

`fmt.Scan`/`fmt.Fscan` parses whitespace-separated input into typed variables. The variable type controls how later arithmetic and comparisons behave.

Apply these rules directly to the task requirement: an integer `n` is entered. Print `YES` if its absolute value is a two-digit number divisible by 7; otherwise print `NO`. In addition, `n` must not be divisible by 176.

💡
NEED HELP? Hints
+

['Write the boolean condition directly, then verify boundary values just below, at, and just above each threshold.', 'Read values in exactly the order stated by the condition.', 'Use the sample input `14` to verify parsing and confirm that the program prints exactly `YES` with no extra text.']

ANSWER Solution
+
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := n
	if a < 0 {
		a = -a
	}
	if (a >= 10 && a <= 99 && a%7 == 0) && n%176 != 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}