Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "os"
- )
- func main() {
- var m, n, l, special, control, num int
- fmt.Scanln(&m)
- fmt.Scanln(&n)
- fmt.Scanln(&l)
- fmt.Scanln(&special)
- fmt.Scanln(&control)
- for i := m; i > 0; i-- {
- for j := n; j > 0; j-- {
- for k := l; k > 0; k-- {
- num = i * 100 + j * 10 + k
- if num % 3 == 0 {
- special += 5
- } else if num % 5 == 0 {
- special -= 2
- } else if num % 2 == 0 {
- special *= 2
- }
- if special >= control {
- fmt.Printf("Yes! Control number was reached! Current special number is %d.", special)
- os.Exit(0)
- }
- }
- }
- }
- fmt.Printf("No! %d is the last reached special number.", special)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement