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.

27) Criar um algoritmo em PORTUGOL que leia um número (NUM) e então imprima osmúltiplos de 3 e 5, ao mesmo tempo, no intervalo fechado de 1 a NUM.algoritmo L3P027;varinteiro: NUM,C;inícioleia(NUM);para C de 1 até NUM façase ( C mod 3 = 0 ) e ( C mod 5 = 0 ) entãoimprima( C );fim-sefim-parafimprogram l3p027;varNUM,C: integer;beginwrite('Digite um numero: ');readLn(NUM);for C := 1 to NUM dobeginif ( C mod 3 = 0 ) and ( C mod 5 = 0 ) thenwriteLn( C );end;end.NUM = input('Digite um numero: ');for C = 1 : NUMif ( mod ( C , 3 ) == 0 ) & ( mod ( C , 5 ) == 0 )disp( C );endend<strong>UFMG</strong> – ICEx – <strong>DCC</strong> – Programação de Computadores – 2º. Sem 2005 – David Menoti 27

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

Saved successfully!

Ooh no, something went wrong!