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.

44) Seja a seguinte série:1, 4, 9, 16, 25, 36, ...Escreva um algoritmo em PORTUGOL que gere esta série até o N-ésimo termo. EsteN-ésimo termo é digitado pelo usuário.algoritmo L3P044;varinteiro: N, C, QUAD;inícioleia(N);para C de 1 até N façaQUAD ← C * C;imprima(QUAD);fim-parafimprogram l3p044;varN, C, QUAD: integer;beginwrite('Digite o numero de termos: ');read(N);for C := 1 to N dobeginQUAD := C * C;writeLn(QUAD);end;end.% N, C, QUAD: integer;N = input('Digite o numero de termos: ');for C = 1 : NQUAD = C * C;disp(QUAD);end<strong>UFMG</strong> – ICEx – <strong>DCC</strong> – Programação de Computadores – 2º. Sem 2005 – David Menoti 45

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

Saved successfully!

Ooh no, something went wrong!