Anda di halaman 1dari 4

2. Un BOING 747 tiene una capacidad de carga para equipaje de aproximadamente 18.000 kg.

Confeccione un algoritmo que controle la recepcin de equipajes para este avin, sabiendo que un bulto no puede exceder la capacidad de carga del avin ni tampoco exceder los 500 Kg. El valor por kilo del bulto es: 0 a 25 Kg. cero soles 25 a 300 Kg. 1500 soles por kilo de equipaje. 300 a 500 Kg. 2500 soles por kilo de equipaje Para un vuelo cualquiera se pide: Nmero total de bultos ingresados para el vuelo Peso del bulto ms pesado y del ms liviano Peso promedio de los bultos Ingreso en soles por concepto de carga

CODIGO: [SELECCIONAR TODO] [EXPANDIR/CONTRAER] [DESCARGAR] (PROBLEMA2.TXT)

1. mayor = 0, menor = 501, bucle = 0, p = 0, b = 0, lb = 0, px = 0, i = 0, n = 0 2. 3. while bucle = 0 4. p = 0 5. while p = 0 6. input b 7. while b > 500 8. print "No puede exceder los 500 kg"; 9. input b 10. endwhile 11. px = px + b 12. p = 1 13. if px > 18000 14. lb = px - 18000 15. print "Capacidad para bs en Kg: " lb; 16. px = px - b 17. p = 0 18. endif 19. endwhile 20. 21. if mayor < b 22. mayor = b 23. endif 24. if menor > b 25. menor = b 26. endif 27. if b <= 25 28. i = i + b*0 29. else 30. if b > 25 and b <= 300 31. i = i + b*1500

32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. i;

else i = i + b*2500 endif endif n = n + 1 if px = 18000 exit endif endwhile print print print print print "Nmero total de bultos: n; "Peso del bulto ms pesado: " mayor; "Peso del bulto ms liviano: " menor; "Peso promedio de los bultos: " px/n; "Ingreso en soles por concepto de carga: "

3. Construya un algoritmo que reciba como entrada el un valor N (N mayor que 29) y calcule una proximacion de la suma de la siguiente serie y termine cuando el septimo decial de la suma sea 5 por programacion modular. 1+1/1! + 1/2!+ 1/3! +........+1/N!

CODIGO: [SELECCIONAR TODO] [EXPANDIR/CONTRAER] [DESCARGAR] (PROBLEMA3.TXT)

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12.

N = 0, r = 1, f = 1, s = 0, d = 0 while N <= 29 input N endwhile Do suma(N)

************************************************* ****** Modulo suma(M) -----------------------------------------------------for j = 1 to (M-1) r = 1 f = 1 while f<=j r=f*r f=f+1 endwhile s = s + 1/r

13. 14. 15. 16. 17. 18. 19. 20.

21. 22. 23. 24. 25. 26. 27.

d = (s*(10^7)) mod 10 if d = 5 exit endif endfor print "La suma es: " 1 + s;

4. Elabore un algoritmo para convertir un numero N de base 3 a base 7

CODIGO: [SELECCIONAR TODO] [EXPANDIR/CONTRAER] [DESCARGAR] (PROBLEMA4.TXT)

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.

validar = 0, N = 0, NR = 0, rr = 0, r = 0, baseA = 0, t = 0, baseB = 0, u = 0 while validar = 0 input N NR = N validar = 1 while NR > 0 rr = NR mod 10 if rr >= 3 validar = 0 exit endif NR = NR div 10 endwhile endwhile

while N > r = N N = N baseA t = t enfor N = baseA while N > r = N N = N baseB

0 mod 10 div 10 = baseA + r*(3^(t)) + 1

0 mod 7 div 7 = baseB + r*(10^(u))

35. 36. 37. 38.

u = u + 1 endwhile print baseB;

5. Se pide hallar un algoritmo que ingrese de letra en letra la frase "LA EXCELENCIA ESTA EN EL ARTE DE REPETIR LAS BUENAS ACCIONES" incluyendo espacios pero no comillas y lo escriba en codigo binario. Se declara una variable L1=CHAR(1) Comando para convertir una letra en su numero N!=ASC(L1)

CODIGO: [SELECCIONAR TODO] [EXPANDIR/CONTRAER] [DESCARGAR] (PROBLEMA5.TXT)

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22.

L = char(1) c = 0, N = 0, j = 0, t = 0, r = 0 while c < 56 input L N = ASC(L) for i = 1 to 8 gotoxy(1,i + j) print 0 endfor t = 0 while N > 0 r = N mod 7 N = N div 7 gotoxy(1,8 + j - t) print r t = t + 1 endwhile c = c + 1 j = j + 8 endwhile

Anda mungkin juga menyukai