%Run
%  gprolog < test6.in

['hoc6.pro'].
func fibor(){
   if($1<3)return 1
   return fibor($1-1)+fibor($1-2)
}
func fact(){
   if($1<2)return 1
   return $1*fact($1-1)
}
func fibox(){
   if($1==1)return $2
   return fibox($1-1,$2+$3,$2)
}
func fibo(){return fibox($1,1,0)}
print "\tfib(41)=", fibo(41), "\n"
fibo(5)
proc hello(){
   while($1>0){
      print $1,"\tHello!\n"
      $1=$1-1
   }
}
proc hellor(){
  if ($1 < 1) {
     print "\n"
     return
  }
  print "Hello!"
  hellor($1-1)
}
i=fibor(18)
hello(i/fact(6))
hellor(5)
func gcd() {
  if ($2 == 0) return $1
  while($1>=$2)$1=$1-$2
  return gcd($2, $1)
}
print "gcd(1001,203)=", gcd(1001,203), "\n"
