Pascal/Turbo Pascal - Pascal, alguna ayuda con esta funcion

 
Vista:
sin imagen de perfil

Pascal, alguna ayuda con esta funcion

Publicado por Federico (10 intervenciones) el 12/11/2013 01:33:23
Escribir una función que devuelva el producto de los dígitos impares de un número entero.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Pascal, alguna ayuda con esta funcion

Publicado por ramon (2158 intervenciones) el 13/11/2013 14:31:25
[En este programa te respondo a las dos preguntas]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
program matrizes;
uses
crt;
const
mx = 5;
nx = 5;
type
matriz = array[1..mx,1..nx] of byte;
var
matrz : matriz;
resu, nume : integer;
 
function producto : integer;
var
n1, num3, nn, clg1, clg2 : longint;
num : array[1..12] of integer;
se, w : integer;
begin
write(' Entra Numero Entero : ');
readln(n1);
producto := 0;
clg1 := n1 mod 10;
nn := n1;
num3 := 0;
clg2 := 0;
w := 1;
while nn > 0 do
begin
num3 := nn mod 10;
nn := nn div 10;
clg2 := (clg2 * 10) + num3;
se := 0;
se := clg2 mod 10;
if se mod 2 = 0 then
else
begin
num[w] := se;
w := w + 1;
end;
end;
num3 := 0;
for se := 1 to w - 1 do
num3 := num3 + num[se];
producto := num3;
writeln;
end;
 
procedure presenta_matriz(a : matriz);
var
vv, gg : integer;
begin
for vv := 1 to nx do
begin
for gg := 1 to mx do
begin
write(' ',a[gg,vv]);
end;
writeln;
end;
end;
 
procedure elimina_central(d : matriz);
var
p, c, t : integer;
begin
for c := 1 to nx do
for t := 1 to mx do
d[t,c] := 1;
writeln(' La Matriz Es ');
writeln;
presenta_matriz(d);
writeln;
c := 0;
t := round(nx / 2);
for p := 1 to nx do
d[c + p,t] := 0;
writeln(' La Borrada queda ');
writeln;
presenta_matriz(d);
end;
 
 
begin
clrscr;
resu := producto;
writeln(' Producto De Los Digitos Impares Es : ',resu);
writeln;
elimina_central(matrz);
readkey;
end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar