Thursday, 17 June 2010

Pascal - Program akar & pangkat dua

{Riyan Hidayat Samosir} {http://bekabe.blogspot.com}
Uses WinCrt;
Var
a,b,c:integer;
Pangkat_a,Pangkat_b,HPangkat_ab,akar,H_akar:Real;
Begin
Write('Nilai a: ');ReadLn(a);
Write('Nilai b: ');ReadLn(b);
Write('Nilai c: ');ReadLn(c);
WriteLn;
WriteLn(' ----------');
WriteLn('------------------------------------------------------------------');
WriteLn(' ----------');
WriteLn;
Pangkat_a:=SQR(a);
Pangkat_b:=SQR(b);
HPangkat_ab:=Pangkat_a+Pangkat_b;
akar:=2*(a*b)-(c*c);
H_akar:=SQRT(akar);
WriteLn(' ',a,'x',a,' + ',b,'x',b,' = ',Pangkat_a:2:0,' + ',Pangkat_b:2:0,' = ',HPangkat_ab:2:0);
WriteLn(' --------------');
WriteLn('\ /''''''''''''''''''''''''''''',' \ /''''''''''''''''''''''',' \ /''''''''''');
WriteLn(' \/ 2(',a,'x',b,') - (',c,'x',c,')',' = \/ 2(',a*b,') - (', c*c,') = ','\/',akar:2:0,' = ',H_akar:2:0);
WriteLn;
WriteLn;
WriteLn(' ----------');
WriteLn('------------------------------------------------------------------');
WriteLn(' ----------');
WriteLn;
WriteLn('============');
WriteLn('Hasil = ',Hpangkat_ab/H_akar:2:0);
WriteLn('============');
End.

2 comments:

desty google said...

gilaa pnjangg amatt . . .

Anonymous said...

lel, kurang jelas om