Skip to Navigation Skip to Content

Kumpulan Ebook Web

Posted under:

CobaUnicode

class CobaUnicode
{
  public static void main(String[]args)
  {
    char a ='\u0061';
    char b ='\u0062';
    char c = '\u0063';
    
    String kata = "\u0061\u0062\u0063";

    System.out.println("A :" + a);
    System.out.println("B :" + b);
    System.out.println("C :" + c);
    System.out.println("Kata :" + kata);
  }
}



 
 
Posted under:

Bubble Sort

class bubbleSort
{   public static void main(String[] args)
    {   int[] x = {29,13,10,7,34,21,4,54,30};
        int i, temp, j;
        System.out.println("Sebelum diurutkan :");
        for(i=0;i
            System.out.print(x[i]+"\t");
        System.out.println("\n");
        for(i=0;i
        {   for(j=0;j
            {   if(x[j] > x[j+1])
                {   temp = x[j];
                    x[j] = x[j+1];
                    x[j+1] = temp;
                }
            }
            for(int k=0;k
                System.out.print(x[k]+"\t");
            System.out.println();
        }
        System.out.println("Setelah diurutkan :");
        for(i=0;i
            System.out.print(x[i]+"\t");
    }
}

 
Posted under:

faktorial

class faktorial
{
  public static void main(String[]args)
  {
    int x=5;
    int hasil=1;
  
    System.out.print(x + "! = ");
   
    if (x==0)
    {
       System.out.print(hasil);
       System.exit (1);
    }
     int i=x;
     do
     {
       System.out.print(i);
       if (i!=1)
       {
         System.out.print("x");
       }
        else
        {
          System.out.print("=");
        }
         hasil*=i;
         i--;
     }
      while(i>=1);
      System.out.println(hasil);
  } 
}
 
 
Posted under:
prez710 on Facebook
Website Value Calculator

Total Tayangan Laman