11.07.2015 Views

Lista 03a - DCC/UFMG

Lista 03a - DCC/UFMG

Lista 03a - DCC/UFMG

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1 1 1 1 149) Sendo S = 1 +2 +2 3 3 + 4 4 + 5 5 + ... +N , um somatório de N (definido peloNusuário) termos, escreva algoritmo em PORTUGOL para calcular S para um númeroN.algoritmo L3P049;varinteiro: N, C;real: S;inícioS ← 0;leia(N);para C de 1 até N façaS ← S + 1 / ( C ** C );fim-paraimprima("S = ",S);fimprogram l3p049;varN, C: integer;S: real;beginwrite('Digite um numero: ');read(N);S := 0;for C := 1 to N doS := S + 1 / ( Exp( C * Ln(C) ) );writeLn('S = ',S:5:4);end.%N, C: integer;%S: real;N = input('Digite um numero: ');S = 0;for C = 1 : NS = S + 1 / C ^ C;endfprintf(1,'S = %f\n',S);<strong>UFMG</strong> – ICEx – <strong>DCC</strong> – Programação de Computadores – 2º. Sem 2005 – David Menoti 50

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

Saved successfully!

Ooh no, something went wrong!