Struktur Data

on 15 Maret 2011

LAtihan 1

<HTML>

<HEAD>

<TITLE> Type Bilangan</TITLE>

</HEAD>
<BODY bgcolor=yellow>

<SCRIPT LANGUAGE = "JavaScript">

<!--

var a = 15;

b = 14;


tambah = a+b;

kali = a*b;



document.write("penambahan (" +a+"+"+b+") = " + tambah);

document.write("<BR>");

document.write("perkalian(" +a+"x"+b+") = " + kali );

document.write("<BR>");



//-->

</SCRIPT>

</BODY>

</HTML>


hasilnya





Latihan 2


<HTML>

<HEAD>

<TITLE> konversi antar sistem bilangan</TITLE>

</HEAD>

<BODY bgcolor=yellow>

<SCRIPT LANGUAGE = "JavaScript">

<!--

function jumlah (x,y) {

var hasil = x + y;



return(hasil);

}

var a = parseInt (prompt("ketika bilangan A = \n ingat jangan string"));

var b = parseInt (prompt("ketika bilangann B = \n ingat jangan string"));

var z = jumlah (a,b);

document.write(z);


document.write("<BR>");

document.write("<hr>");

document.write("tipe data nya adalah =" + typeof(z));




//-->

</SCRIPT>

</BODY>

</HTML>
รข��

hasilnya





LAtihan 3


<HTML>

<HEAD>

<TITLE> konversi antar sistem bilangan</TITLE>

</HEAD>

<BODY bgcolor=yellow>

<SCRIPT LANGUAGE = "JavaScript">

<!--

var bil = new Number(25);

document.write("bilangan desimal: "+bil + "<BR>");

document.write(""<HR>"");


document.write("Biner: " + bil. toString(2) + "<BR>");

document.write("oktal : " + bil. toString(8) + "<BR>");

document.write("Heksa : " + bil.toString (16) + "<BR>");




//-->

</SCRIPT>

</BODY>

</HTML>

hasilnya


gbr-1




gbr-2




gbr-3