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.

37) Escreva um algoritmo em PORTUGOL que determine todos os divisores de um dadonúmero N.algoritmo L3P037;varinteiro: N, C;inícioleia(N);para C de 1 até N façase (N mod C = 0 ) entãoimprima(C," é divisor de ",N);fim-sefim-parafimprogram l3p037;varN, C: integer;beginwrite('Digite um numero: ');readLn(N);for C := 1 to N doif (N mod C = 0 ) thenwriteLn(C,' eh divisor de ',N);end.% N, C: integer;N = input('Digite um numero: ');for C = 1 : Nif ( mod( N , C ) == 0 )fprintf(1,'%d eh divisor de %d\n',C,N);endend<strong>UFMG</strong> – ICEx – <strong>DCC</strong> – Programação de Computadores – 2º. Sem 2005 – David Menoti 37

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

Saved successfully!

Ooh no, something went wrong!