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.

48) Faça um algoritmo em PORTUGOL para calcular o valor de S, dado por:sendo N fornecido pelo teclado.algoritmo L3P048;varinteiro: N, C;real: S;inícioS ← 0;leia(N);para C de 1 até N façaS ← S + C / ( N – C + 1 );fim-paraimprima("S = ",S);fimS 1 2 3 N −1N= + + + K +N N −1N − 2 2+ 1program l3p048;varN, C: integer;S: real;beginwrite('Digite um numero: ');read(N);S := 0;for C := 1 to N doS := S + C / ( N - C + 1 );writeLn('S = ',S:5:4);end.%N, C: integer;%S: real;N = input('Digite um numero: ');S = 0;for C = 1 : NS = S + C / ( N - C + 1 );endfprintf(1,'S = %f\n',S);<strong>UFMG</strong> – ICEx – <strong>DCC</strong> – Programação de Computadores – 2º. Sem 2005 – David Menoti 49

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

Saved successfully!

Ooh no, something went wrong!