Advertisement
_LoneWanderer_

Maior elemento

May 2nd, 2024
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | Source Code | 0 0
  1. algoritmo "Maior elemento"
  2. var
  3.    numero : vetor[1..5] de inteiro
  4.    i, maior : inteiro
  5.  
  6. inicio
  7.    para i de 1 ate 5 faca
  8.       escreval ("digite a posição",i)
  9.       leia (numero[i])
  10.       se i = 1 entao
  11.          maior <- numero[i]
  12.  
  13.       senao
  14.          se numero[i] > maior entao
  15.             maior <- numero[i]
  16.          fimse
  17.       fimse
  18.    fimpara
  19.    escreval ("meu maior numero é: ", maior)
  20.  
  21.  
  22.  
  23. fimalgoritmo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement