algorithm for common divisor

dont know if im writing in right section, but heres the problem: i have to write a program to find at least one common divisor of 3 numbers.. the problem is, that its not allowed to use while,for,functions and procedures (pascal language is needed). so only if,else,mod... my last try was

procedure cd(a,b,c,d) {

if((a mod d = 0) and (b mod d = 0) and......)

....

else

cd(a,b,c,d+1)

}

but like i said, procedures seems to be not allowed.. so is there any possible solution? :)