Tengo el siguiente código
Si en la tabla tengo los valores (id, valor) = {(1, 10), (2, 20), (3, 30)}, ¿qué imprimen los msg del programa?for each
where[condiciones] [condiciones]
do 'Promedio'
msg('Id = ' + str(id) + '; valor = ' + str(valor))
endfor
Sub 'Promedio'
&cantidad = 0
&total = 0
for each
where// mismas condiciones que arriba
if valor <> 0
&cantidad += 1
&total += valor
endif
endfor
if &cantidad <> 0
&promedio = &total / &cantidad
endif
EndSub
a)
id = 1, valor = 10
id = 2, valor = 20
id = 3, valor = 30
b)
id = 1, valor = 10
id = 2, valor = 10
id = 3, valor = 10
c)
id = 1, valor = 20
id = 2, valor = 20
id = 3, valor = 20
d)
id = 1, valor = 30
id = 2, valor = 30
id = 3, valor = 30
Justificar la respuesta :)
4 comentarios: