Kamis, 22 Mei 2014

Program Java Mencetak Bilangan Urut (12345678910987654321)

Beri nama Program anda : UrutBilangan

import java.util.*;

public class UrutBilangan
{
 public static void main(String args[])
 {
  Scanner in = new Scanner(System.in);
  System.out.print("Masukkan nomer : ");
  int t = in.nextInt();
  System.out.println(" ");

  int i, j, k, l, m, n, p;
  for ( i = 0 ; i <= t; i++)
  {
   for( j = 1 ; j < i ; j++)
   {
   }
   if(i==j)
   {
    k = i;
    l = k;
    System.out.print(l+" ");
  
    if(l==t)
    {
        t = t - 1;
        for(p = 1 ; p <= t ; p++)
        {
         n = l - 1;
         l = n;
         System.out.print(n+" ");
        }
    }
   }
  }
 }

}
Filed Under :

0 komentar for "Program Java Mencetak Bilangan Urut (12345678910987654321)"

Posting Komentar

background