public class aritmatikaDemo
{
public static void main(String[] args)
{
//sedikit angka
int i = 37;
int j = 42;
double x = 27.475;
double y = 7.22;
System.out.println("Variable values...");
System.out.println(" i = " + i);
System.out.println(" j = " + j);
System.out.println(" x = " + x);
System.out.println(" y = " + y);
//penjumlahan angka
System.out.println("Adding...");
System.out.println(" i + j = " + (i + j));
System.out.println(" x + y = " + (x + y));
//pengurangan angka
System.out.println("Subtracting...");
System.out.println(" i - j = " + (i - j));
System.out.println(" x - y = " + (x - y));
//perkalian angka
System.out.println("Multiplying...");
System.out.println(" i * j = " + (i * j));
System.out.println(" x * y = " + (x * y));
//pembagian angka
System.out.println("Dividing...");
System.out.println(" i / j = " + (i / j));
System.out.println(" x / y = " + (x / y));
//menghitung hasil modulus dari pembagian
System.out.println("Computing the remainder...");
System.out.println(" i % j = " + (i % j));
System.out.println(" x % y = " + (x % y));
//tipe penggabungan
System.out.println("Mixing tipes...");
System.out.println(" j + y = " + (j + y));
System.out.println(" i * x = " + (i * x));
}
}
simpan dengan nama aritmatikaDemo.java
Category
Blog Archive
-
▼
2008
(22)
-
▼
Desember
(11)
- Terbilang Java
- nilai_akhir
- aritmatikaDemo
- Saat Terakhir
- Instalasi Java pada OpenSUSE
- INSTALL JAVA DAN NETBEANS DI LINUX + SET PATH
- Dari Java ke Ruby
- "Membuat Gantt Chart dengan JFreeChart”
- Instal Java di Linux
- Perbedaan Programer Otodidak dan Programer Lulusan IF
- Cara Memasang Header Flash .swf pada Blog
-
▼
Desember
(11)
Blog's Teman
Link Download
Kritik Saran
chat
Rabu, 24 Desember 2008
aritmatikaDemo
Diposting oleh Jouhari di 10:46:00 AM
Label: Arsip java (newbi)
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar