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.

18) Criar um algoritmo em PORTUGOL que imprima todos os números de 1 até 100,inclusive, e a soma da metade desses números.algoritmo L3P018;varinteiro: C;real: SOMA;inícioSOMA ← 0;para C de 1 até 100 façaimprima(C);SOMA ← SOMA + C / 2;fim-paraimprima("O valor da soma das metades é: ",SOMA);fimprogram l3p018;varC: integer;SOMA: real;beginSOMA := 0;for C := 1 to 100 dobeginwriteLn(C);SOMA := SOMA + C / 2;end;writeLn('O valor da soma das metades eh: ',SOMA:3:2);end.SOMA = 0;for C = 1 : 100disp( C );SOMA = SOMA + C / 2;endfprintf(1,'O valor da soma das metades eh: %f\n',SOMA);<strong>UFMG</strong> – ICEx – <strong>DCC</strong> – Programação de Computadores – 2º. Sem 2005 – David Menoti 18

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

Saved successfully!

Ooh no, something went wrong!