Advertisement
AlexRodrigues22

Untitled

Aug 4th, 2022 (edited)
1,032
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ALGORITMO "3nomes"
  2. // Disciplina  : [Algoritmos e Programação Estruturada]
  3. // Professor   : Wesley Viana Pereira
  4. // Descrição   : Algoritmo que coleta e exibe 3 nomes
  5. // Autor(a)    : Alex Rodrigues
  6. // Data atual  : 04/08/2022
  7. VAR
  8.    nomes: VETOR[1..3] DE CARACTER
  9.    qtdNomes: INTEIRO
  10. INICIO
  11.       qtdNomes <- 1
  12.  
  13.       // Solicita 3 nomes ao usuário e se não vazio, os coloca no vetor
  14.       ENQUANTO (qtdNomes <= 3) FAÇA
  15.                ESCREVA("Digite o ", qtdNomes, "º nome: ")
  16.                LEIA(nomes[qtdNomes])
  17.  
  18.                SE nomes[qtdNomes] = "" ENTÃO
  19.                        ESCREVAL("Digite um nome válido.")
  20.                SENAO
  21.                     qtdNomes <- qtdNomes + 1
  22.                FIMSE
  23.       FIMENQUANTO
  24.  
  25.       ESCREVAL("")
  26.       ESCREVAL("===== Nomes Digitados =====")
  27.       ESCREVAL("Nome 1: ", nomes[1])
  28.       ESCREVAL("Nome 2: ", nomes[2])
  29.       ESCREVAL("Nome 3: ", nomes[3])
  30. FIMALGORITMO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement