Selasa, 10 Januari 2012

javascript luas lingkaran

<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
    background-image: url(wp_120393_2.jpg);
}
.style1 {color: #FF0000}
.style3 {color: #00FF00}
.style4 {color: #00FFFF}
-->
</style><body>
<TITLE></TITLE>
<span class="style1"><BODY ALT="">
<SCRIPT language="JavaScript">

function luasling()
{
var jari = parseFloat(document.llg.ijari.value);
var luas = 3.14*jari*jari;

document.llg.ojari.value = jari;
document.llg.oluas.value = luas;
}
</SCRIPT>
</span>
<FORM NAME ="llg" class="style3">
<H2 class="style4" >MENGHITUNG LINGKARAN </H2>
<div>
  <h3><span class="style4">Masukkan Jari -jari :</span>
    <input type="text" size="10" name="ijari">
    <br>
  </h3>
</div>
<p>
<input name="button" type="button" onClick="luasling()" value="HITUNG">
<input name="reset" type="reset" value="RESET">
<input type="text" size="10" name="ojari">
<h3><span class="style4">Hasil =</span>
  <input name="oluas" type="text" size="10">
</h3>
<p>
</form>
</BODY>
</HTML>

Sabtu, 31 Desember 2011

Pengulangan C++ dengan menggunakan for


1.         Buatlah program untuk menampilkan seperti tampilan dibawah ini dibawah ini
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

Listing program
#include "stdio.h"
#include "conio.h"
void main()
{
clrscr();
int a,b;
for (a=5;a>=1;a--)
{
for(b=1;b<=a;b++)
{
printf("%i ",b);
}
printf("\n");
}
getch();
}
Hasil program



2.         Buatlah program untuk menampilkan seperti tampilan dibawah ini dibawah ini
 1 1 1 1 1
2 2 2 2
3 3 3
4 4
5
Listing program
#include "conio.h"
#include "stdio.h"
void main()
{
clrscr();
int a,b;
for (a=1;a<=5;a++)
{
for(b=5;b>=a;b--)
{
      printf("%i ",a);
}
printf("\n");
}
getch();
}
Hasil program




3.         Buatlah program untuk menampilkan seperti tampilan dibawah ini dibawah ini
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
Listing program
#include "conio.h"
#include "stdio.h"
void main()
{
clrscr();
int a,b;
for (a=1;a<=5;a++)
{
for(b=1;b<=3;b++)
{
      printf("%i ",a);
}
printf("\n");
}
getch();
}
 
 
Hasil program

Senin, 19 Desember 2011

pembuatan tabel harga fotocopy-an


Listing Program
#include "stdio.h"
#include "conio.h"
void main()
{
int c;
printf("Tarif Fotokopi per lembar : \n");
printf("\n");
printf("*++============================================++*\n");
printf("*  Lembar   |    Harga 70 Gr  |    Harga 80 Gr   *\n");
printf("*++--------------------------------------------++*\n");
for(c=1;c<=100;c=c+1)
printf("|    %i     |        %i       |       %i         |\n",c,c*80,c*100);
printf("--------------------------------------------------\n");
getch();
}