-
Lenguaje
Pascal
-
Descripción
Determinar si un valor N (cualquiera), es divisor común de otros dos valores X y Y (que se ingresan por teclado).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
program DivisorComunDeDosValores;
uses crt;
var n, x, y : integer;
begin
write ('Ingresa el valor de n: ');
readln (n);
write ('Ingresa el valor de x: ');
readln (x);
write ('Ingresa el valor de y: ');
readln (y);
if (x mod n=0) and (y mod n=0) then
begin
writeln ('N s'#161' es divisor com'#163'n de X y Y.');
end
else
begin
writeln ('N no es divisor com'#163'n de X y Y.');
end;
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var n, x, y : integer;
begin
write ('Ingresa el valor de n: ');
readln (n);
write ('Ingresa el valor de x: ');
readln (x);
write ('Ingresa el valor de y: ');
readln (y);
if (x mod n=0) and (y mod n=0) then
begin
writeln ('N s'#161' es divisor com'#163'n de X y Y.');
end
else
begin
writeln ('N no es divisor com'#163'n de X y Y.');
end;
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.