003
This commit is contained in:
29
divisibility_by_7.v
Normal file
29
divisibility_by_7.v
Normal file
@@ -0,0 +1,29 @@
|
||||
import readline
|
||||
|
||||
fn check_divisibility(e int, g int) {
|
||||
b := e / 10
|
||||
c := e % 10
|
||||
d := b - 2 * c
|
||||
mut f := g
|
||||
if d > 99 {
|
||||
f = f + 1
|
||||
check_divisibility(d, f)
|
||||
} else {
|
||||
if d % 7 == 0 {
|
||||
println([d, f])
|
||||
} else {
|
||||
println('The number is not divisible by 7')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mut r := readline.Readline{}
|
||||
answer := r.read_line('What is your number: ')!
|
||||
|
||||
a := answer.int()
|
||||
|
||||
if a > 99 {
|
||||
check_divisibility(a, 1)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user