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.

program l3p057;varC, NMAT,MNMAT1,MNMAT2: integer;NOTA,MNOTA1,MNOTA2: real;beginfor C := 1 to 100 dobeginwrite('Entre com o numero de matricula: ');read(NMAT);write('Entre com a nota: ');read(NOTA);if ( C = 1 ) or ( NOTA > MNOTA1 ) then beginMNOTA2 := MNOTA1;MNMAT2 := MNMAT1;MNOTA1 := NOTA;MNMAT1 := NMAT; endelseif ( C = 2 ) or ( NOTA > MNOTA2 ) then beginMNOTA2 := NOTA;MNMAT2 := NMAT; end;end;writeLn('Numero de Matricula: ',MNMAT1,' tem a maior nota: ',MNOTA1:5:1);writeLn('Numero de Matricula: ',MNMAT2,' tem a segunda maior nota: ',MNOTA2:5:1);end.program l3p057b;varC, NMAT,MNMAT1,MNMAT2: integer;NOTA,MNOTA1,MNOTA2: real;beginwrite('Entre com o numero de matricula: ');read(NMAT);write('Entre com a nota: ');read(NOTA);MNOTA1 := NOTA;MNMAT1 := NMAT;write('Entre com o numero de matricula: ');read(NMAT);write('Entre com a nota: ');read(NOTA);if ( NOTA > MNOTA1 ) then beginMNOTA2 := MNOTA1;MNMAT2 := MNMAT1;MNOTA1 := NOTA;MNMAT1 := NMAT; endelse beginMNOTA2 := NOTA;MNMAT2 := NMAT; end;for C := 3 to 100 dobeginwrite('Entre com o numero de matricula: ');read(NMAT);write('Entre com a nota: ');read(NOTA);if ( NOTA > MNOTA1 ) then beginMNOTA2 := MNOTA1;MNMAT2 := MNMAT1;MNOTA1 := NOTA;MNMAT1 := NMAT; endelse if ( NOTA > MNOTA2 ) then beginMNOTA2 := NOTA;MNMAT2 := NMAT; end;end;writeLn('Numero de Matricula: ',MNMAT1,' tem a maior nota: ',MNOTA1);writeLn('Numero de Matricula: ',MNMAT2,' tem a segunda maior nota: ',MNOTA2);readln(c);end.<strong>UFMG</strong> – ICEx – <strong>DCC</strong> – Programação de Computadores – 2º. Sem 2005 – David Menoti 68

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

Saved successfully!

Ooh no, something went wrong!