Monday 3 December 2012

JAWABAN MIDTERM TEORI DDPK

 

Kelas Reg A dan JMU

1.       Program No1;

Uses crt;

Var V,x,t,h: real;

Begin

Clrscr;

Writeln(‘input nilai h: ‘);readln(h);

Writeln(‘input nilai x: ’);readln(x);

G:=10;

T:=sqrt((2*h)/g);

V:=x/t;

Writeln(‘kecepatan minimumnya adalah: ’,v:3:0,’ m/s’);

Readln;

End.

 

2.       Program iterasi;

uses crt;

var a,b,c,d,e,f,g,h,i,j: integer;

begin

clrscr;

writeln('=================================');

writeln('      a        b      c        d');

writeln('=================================');

for i:=1 to 5 do

begin

j:=(2*i)-1;

a:=(j*10)-2;

b:=(2*a)-2;

c:=(a+b);

d:=(c-a-2)*-1;

writeln(a:8,b:8,c:8,d:8);

e:=e+a;

f:=f+b;

g:=g+c;

h:=h+d;

end;

writeln('=================================');

writeln(e:8,f:8,g:8,h:8);

readln;

end.

 

3.       Program nilai1;

Uses crt;

Var nilai : integer;

Begin

Clrscr;

Writeln(‘masukkan nilai didapat: ‘); readln(nilai);

If nilai>85 then

Writeln(‘A’)

Else

If nilai>75 then

Writeln(‘B+’)

Else

If nilai>65 then

Writeln(‘B’)

else

If nilai>55 then

Writeln(‘C+’)

else

If nilai>45 then

Writeln(‘C’)

else

If nilai>35 then

Writeln(‘D’)

Else

Writeln(‘E’);

Readln;

End.

2 komentar:

t.rizal azqia said...

maaf bg,, program yg pertama erorr

Unknown said...

maaf, kesilapan, pada bentuk variabelnya tambahkan nilai G sehingga menjadi sebagai berikut:

Program No1;
Uses crt;
Var V,x,t,h,G: real;
Begin
Clrscr;
Writeln(‘input nilai h: ‘);readln(h);
Writeln(‘input nilai x: ’);readln(x);
G:=10;
T:=sqrt((2*h)/g);
V:=x/t;
Writeln(‘kecepatan minimumnya adalah:’,v:3:0,’ m/s’);
Readln;
End.