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.

20) Criar um algoritmo em PORTUGOL que imprima todos os números de 1 até 100,inclusive, e a média de todos eles.algoritmo L3P020;varinteiro: C,SOMA;real: MEDIA;inícioSOMA ← 0;para C de 1 até 100 façaimprima(C);SOMA ← SOMA + C;fim-paraMEDIA ← SOMA / 100;imprima("O valor da média é: ",MEDIA);fimprogram l3p020;varC : integer;SOMA,MEDIA: real;beginSOMA := 0;for C := 1 to 100 dobeginwriteLn(C);SOMA := SOMA + C;end;MEDIA := SOMA / 100;writeLn('O valor da media eh: ',MEDIA:3:2);end.SOMA = 0;for C = 1:100disp( C );SOMA = SOMA + C;endMEDIA = SOMA / 100;fprintf(1,'O valor da media eh: %f\n',MEDIA);<strong>UFMG</strong> – ICEx – <strong>DCC</strong> – Programação de Computadores – 2º. Sem 2005 – David Menoti 20

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

Saved successfully!

Ooh no, something went wrong!