Académique Documents
Professionnel Documents
Culture Documents
Accin
ejecutada
Inicial
t1
t2
t3
t4 cont.
t5
t6
t7
t4 cont.
t5
t6
t7
t4 cont.
t5
t6
t7
t4 fin
t8
Algoritmo producto_numeros
Var
N1, N2, Producto, I :Entero
Inicio
(t1.1) Producto 0
(t1.2) I 1
(t2.1) Leer N1
(t2.2) Leer N2
(t3) Mientras (I <= N2) hacer
(t4) Producto producto+N1
(t5) I I+1
Finmientras
(t6) Escribir Producto=producto
Fin
Accin
ejecutada
Inicial
t1.1
t1.2
t2.1
t2.2
t3 cont
t4
t5
t3 cont.
t4
t5
t3 cont.
t4
t5
t3 fin
t6
N2
Indet.
Indet.
Indet.
Indet.
3
3
3
3
3
3
3
3
3
3
3
3
I
Indet.
Indet.
1
1
1
1
1
2
2
2
3
3
3
4
4
4
Salida
Producto
Indet.
0
0
0
0
0
a
a
a
a+a
a+a
a+a
a+a+a
a+a+a
a+a+a
a+a+a a+a+a
c. Calcule el cociente entero y el resto de dividir dos nmeros naturales a y b, con a mayor o igual que b,
mediante restas sucesivas.
Algoritmo cociente_resto_numeros
Var
a, b, cociente :Entero
Inicio
(t1.1) Leer a
(t1.2) Leer b
(t2) Cociente 0
(t3) Si (a < b) entonces
(t4.1) Escribir divisor mayor que
dividendo
Sino
(t4.2) Mientras (b<=a) hacer
(t5.1)a a-b
(t5.2)cociente cociente+1
Finmientras
(t6.1) Escribir Cociente=cociente
(t6.2) Escribir Resto= a
Finsi
Fin
Accin
ejecutada
Salida
Inicial
t1.1
t1.2
t2
t3->t4.1
t4.1 fin
a
Indet.
5
5
5
5
5
b
Indet.
Indet.
7
7
7
7
cociente
Indet.
Indet.
Indet.
0
0
0
dvsor>dvdo
Inicial
t1.1-t1.2
t2
t3->t4.2
t4.2 cont
t5.1-t5.2
t4.2 cont
t5.1-t5.2
t4.2 cont
t5.1-t5.2
t4.2 fin
t6.1
t6.2
Indet.
17
17
17
17
12
12
7
7
2
2
2
2
Indet.
5
5
5
5
5
5
5
5
5
5
5
5
Indet.
Indet.
0
0
0
1
1
2
2
3
3
3
3
Cte=3
Rto=2
Accin
ejecutada
Salida
N Impar
N Par
Algoritmo suma_n_pares
Var
N, suma, I :Entero
Inicio
(t1)Leer N
(t2.1)Suma 0
(t2.2)I 1
(t3) Mientras (I < = N) hacer
(t4.1) suma suma+2*I
(t4.2) I I+1
Finmientras
(t5) Escribir Suma=,suma
Fin
Accin
ejecutada
Inicial
t1
t2.1-t2.2
t3 cont
t4.1-t4.2
t3 cont
t4.1-t4.2
t3 cont
t4.1-t4.2
t3 cont
t4.1-t4.2
t3 fin
t5
suma
Indet.
Indet.
0
0
2
2
6
6
12
12
20
20
20
I
Indet.
Indet.
1
1
2
2
3
3
4
4
5
5
5
Salida
Suma=20