/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package igarah;
/**
*
* @author ASUS
*/
public class looping {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
for(int k=1; k<=4; k++){
for (int j=1; j<=k; j++)
System.out.print(k);
System.out.print("\n");
// TODO code application logic here
}
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package igara;
/**
*
* @author ASUS
*/
public class looptugas {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
for(int a=1; a<=5; a++){
for (int b=1; b<=a; b++)
System.out.print(b);
System.out.print("\n") ;
// TODO code application logic here
}
}
}
/*
* 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);
}
}