/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Igarah;
import java.util.Scanner;
/**
*
* @author ASUS
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int p ;
int l ;
int h ;
int k ;
System.out.println("\n Masukkan Panjang = ");
Scanner input = new Scanner (System.in) ;
p = input.nextInt();
System.out.println("\n Masukkan Lebar = ");
Scanner in = new Scanner (System.in);
l = input.nextInt();
h = p*l ;
System.out.println("Hasil dari Luas =" +h);
k = 2*p + 2*l ;
System.out.println("Hasil dari Keliling =" +k);
}
}
Senin, 17 Oktober 2011
TUGASALGORITMA PERSEGI
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Igarah;
import java.util.Scanner;
/**
*
* @author ASUS
*/
public class luas_bujursangkar {
public static void main(String[] args) {
int s ;
int h ;
int k ;
System.out.println("\n Masukkan sisi = ");
Scanner input = new Scanner (System.in);
s = input.nextInt() ;
h = s * s ;
System.out.println("Luas ="+h);
k = 4 * s ;
System.out.println("Keliling ="+k);
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Igarah;
import java.util.Scanner;
/**
*
* @author ASUS
*/
public class luas_bujursangkar {
public static void main(String[] args) {
int s ;
int h ;
int k ;
System.out.println("\n Masukkan sisi = ");
Scanner input = new Scanner (System.in);
s = input.nextInt() ;
h = s * s ;
System.out.println("Luas ="+h);
k = 4 * s ;
System.out.println("Keliling ="+k);
}
}
TUGAS ALGORITMA NILAI
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Igarah;
import java.util.Scanner;
/**
*
* @author ASUS
*/
public class nilai {
public static void main(String[] args) {
int n ;
System.out.println("\n Masukkan Nilai = ");
Scanner input = new Scanner (System.in) ;
n = input.nextInt();
if (n>=0 && n<=40)
System.out.println("E");
if (n>=41 && n<=50)
System.out.println("D");
if (n>=51 && n<=60)
System.out.println("C");
if (n>=61 && n<=70)
System.out.println("B");
if (n>=71 && n<=100)
System.out.println("A");
if (n>100)
System.out.println("Eror");
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Igarah;
import java.util.Scanner;
/**
*
* @author ASUS
*/
public class nilai {
public static void main(String[] args) {
int n ;
System.out.println("\n Masukkan Nilai = ");
Scanner input = new Scanner (System.in) ;
n = input.nextInt();
if (n>=0 && n<=40)
System.out.println("E");
if (n>=41 && n<=50)
System.out.println("D");
if (n>=51 && n<=60)
System.out.println("C");
if (n>=61 && n<=70)
System.out.println("B");
if (n>=71 && n<=100)
System.out.println("A");
if (n>100)
System.out.println("Eror");
}
}
BILANGAN PRIMA
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Igarah;
import java.util.Scanner;
/**
*
* @author ASUS
*/
public class Bilangan_prima {
public static void main(String[] args) {
int n;
System.out.println("\n Masukkan Angka yang akan diuji = ");
Scanner input = new Scanner (System.in) ;
n = input.nextInt();
boolean isPrime = false;
if (n >= 2) {
isPrime = true;
for (int x = 2; x < n; x++) {
if (n % x == 0) {
isPrime = false;
}
}
}
System.out.println("the answer is " + isPrime);
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Igarah;
import java.util.Scanner;
/**
*
* @author ASUS
*/
public class Bilangan_prima {
public static void main(String[] args) {
int n;
System.out.println("\n Masukkan Angka yang akan diuji = ");
Scanner input = new Scanner (System.in) ;
n = input.nextInt();
boolean isPrime = false;
if (n >= 2) {
isPrime = true;
for (int x = 2; x < n; x++) {
if (n % x == 0) {
isPrime = false;
}
}
}
System.out.println("the answer is " + isPrime);
}
}
Rabu, 12 Oktober 2011
Selasa, 11 Oktober 2011
Senin, 10 Oktober 2011
Langganan:
Komentar (Atom)



