TrabalhosGratuitos.com - Trabalhos, Monografias, Artigos, Exames, Resumos de livros, Dissertações
Pesquisar

Algoritmo em PORTUGOL

Resenha: Algoritmo em PORTUGOL. Pesquise 860.000+ trabalhos acadêmicos

Por:   •  8/11/2014  •  Resenha  •  473 Palavras (2 Páginas)  •  706 Visualizações

Página 1 de 2

hvhvh40) Criar um algoritmo em PORTUGOL que leia o destino do passageiro, se a viagem

inclui retorno (ida e volta) e informar o preço da passagem conforme a tabela a seguir:

Condição Ida Ida e Volta

Região Norte R$ 500,00 R$ 900,00

Região Nordeste R$ 350,00 R$ 650,00

Região Centro-Oeste R$ 350,00 R$ 600,00

Região Sul R$ 300,00 R$ 550,00

algoritmo L2P40;

var

real: PRECO;

inteiro: OPCAO;

lógico: VOLTA;

início

leia(OPCAO);

leia(VOLTA);

se ( VOLTA ) então

se ( OPCAO = 1 ) então

PRECO <- 900;

senão-se ( OPCAO = 2 ) então

PRECO <- 650;

senão-se ( OPCAO = 3 ) então

PRECO <- 600;

senão-se ( OPCAO = 4 ) então

PRECO <- 550;

senão

imprima("Opção inválida!");

fim-se

senão

se ( OPCAO = 1 ) então

PRECO <- 500;

senão-se ( OPCAO = 2 ) então

PRECO <- 350;

senão-se ( OPCAO = 3 ) então

PRECO <- 350;

senão-se ( OPCAO = 4 ) então

PRECO <- 300;

senão

imprima("Opção inválida!");

fim-se

fim-se

fim

Universidade Federal de Ouro Preto – UFOP

Instituto de Ciências Exatas e Biológicas – ICEB

Departamento de Computação – DECOM

Disciplina: Algoritmos e Estrutura de Dados I – CIC102

Professor: David Menotti (menottid@gmail.com)

UFOP – ICEB – DECOM –2º. Sem 2008 – David Menotti 58

program lp2p40;

var

PRECO: real;

OPCAO: integer;

VOLTA: char;

begin

writeLn('Viagem');

writeLn('1) Regiao Norte');

writeLn('2) Regiao Nordeste');

writeLn('3) Regiao Centro-Oeste');

writeLn('4) Regiao Sul');

write('Digite o numero correspondente ao destino do passageiro: ');

readLn(OPCAO);

write('A viagem inclui retorno? (S/N) ');

readLn(VOLTA);

if (VOLTA = 'S') or (VOLTA = 's') then

if ( OPCAO = 1 ) then

PRECO := 900

else if ( OPCAO = 2 ) then

PRECO := 650

else if ( OPCAO = 3 ) then

PRECO := 600

else if ( OPCAO = 4 ) then

PRECO := 550

else

writeLn('Opcao invalida!')

else

if ( OPCAO = 1 ) then

PRECO := 500

else if ( OPCAO = 2 ) then

PRECO := 350

else if ( OPCAO = 3 ) then

PRECO := 350

else if ( OPCAO = 4 ) then

PRECO := 300

else

writeLn('Opcao

...

Baixar como (para membros premium)  txt (3.5 Kb)  
Continuar por mais 1 página »
Disponível apenas no TrabalhosGratuitos.com