11.10.2015 Views

Divisores

LfDvOp

LfDvOp

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

APÉNDICE<br />

F UNCIÓN ESDI VIS IBLE<br />

Argumento: Dos números enteros<br />

Valor: Devuelve True si el primero es divisible entre el segundo y False<br />

si no lo es.<br />

Código en Basic<br />

public function esdivisible(a,b) as boolean<br />

if int(a/b)=a/b then esdivisible=True else esdivisible=False<br />

end function<br />

F UNCIÓN MENORDIV<br />

Argumento: Un número entero positivo<br />

Valor: Devuelve el menor divisor de dicho número.<br />

Código en Basic<br />

function menordiv(a)<br />

dim n<br />

dim vale as boolean<br />

vale=true (permite seguir el algoritmo)<br />

n=1 (Comenzamos a buscar en el 1)<br />

while vale and n

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!