11.07.2015 Views

Lista 03a - DCC/UFMG

Lista 03a - DCC/UFMG

Lista 03a - DCC/UFMG

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

14) Escreva um algoritmo em PORTUGOL que receba quinze números do usuário eimprima a raiz quadrada de cada número.algoritmo L3P014;varinteiro: C;real: VALOR, RAIZ;iníciopara C de 1 até 15 façaleia(VALOR);se ( VALOR >= 0 ) entãoRAIZ ← raiz(VALOR);imprima(RAIZ);senãoimprima("Não é possível calcular a raiz quadrada! Número negativo!");fim-sefim-parafimprogram l3p014;varC: integer;VALOR, RAIZ: real;beginfor C := 1 to 15 dobeginwrite('Digite um valor: ');readLn(VALOR);if ( VALOR >= 0 ) then beginRAIZ := SqRt(VALOR);writeLn(RAIZ:3:2); endelsewriteLn('Nao eh possivel calcular a raiz quadrada! Numero negativo!');end;end.for C = 1 : 15VALOR = input('Digite um valor: ');if ( VALOR >= 0 )RAIZ = sqrt( VALOR );disp( RAIZ );elsedisp('Nao eh possivel calcular a raiz quadrada! Numero negativo!');endend<strong>UFMG</strong> – ICEx – <strong>DCC</strong> – Programação de Computadores – 2º. Sem 2005 – David Menoti 14

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!