Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. Vetor = 1:5
  2. Vetor(1) = input("Digite o primeiro valor: ")
  3. Vetor(2) = input("Digite o segundo valor: ")
  4. Vetor(3) = input("Digite o terceiro valor: ")
  5. Vetor(4) = input("Digite o quarto valor: ")
  6. Vetor(5) = input("Digite o quinto valor: ")
  7. for b = 1:5
  8. if (modulo(Vetor(b),1) ~= 0 | Vetor(b)<0) then
  9. printf("Um valor digitado não é inteiro ou nulo!")
  10. abort()
  11. end
  12. end
  13. for a = 1:5
  14. printf("%g ",Vetor(a))
  15. end
  16.  
  17.  
  18.  
  19. Vetor = 1:10
  20. for a = 1:10
  21. if a==1 then
  22. String = "Digite o primeiro valor: "
  23. end
  24. if a~=1 then
  25. String = "Digite o seguinte valor: "
  26. end
  27. Vetor(a) = input(String)
  28. end
  29.  
  30. for b = 10:-1:1
  31. printf("%g \ ",Vetor(b))
  32. end
  33.  
  34.  
  35.  
  36. Nota = 1:4
  37. Sum = 0
  38.  
  39. for a = 1:4
  40. if a == 1 then
  41. Aluno = "Digite a Primeira Nota: "
  42. end
  43. if a == 2 then
  44. Aluno = "Digite a Segunda Nota: "
  45. end
  46. if a == 3 then
  47. Aluno = "Digite a Terceira Nota: "
  48. end
  49. if a == 4 then
  50. Aluno = "Digite a Quarta Nota: "
  51. end
  52.  
  53. Nota(a) = input(Aluno)
  54. end
  55.  
  56. for b = 1:4
  57. if(modulo(Nota(b),1) ~= 0 | Nota(b)<0) then
  58. printf("Uma das notas é inválida!!")
  59. abort()
  60. end
  61. end
  62.  
  63. for b = 1:4
  64. Sum = Sum + Nota(b)
  65. end
  66.  
  67. Media = Sum/4
  68.  
  69. printf("A média do aluno é %g",Media)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement