Showing posts with label Number pattern in java. Show all posts
Showing posts with label Number pattern in java. Show all posts

Saturday, November 1, 2014

, , ,

number Pattern 1 by while loop


Code Box by while loop
--------------------------------
/*program to print number pattern square box by while loop

  12345
  12345
  12345
  12345
  12345

*/

class npat1w
{
public static void main(String a[])
{
int n,i,j;
i=1;
n=Integer.parseInt(a[0]);

while(i<=n)
{j=1;
        while(j<=n)
        {
        System.out.print(j);
        j++;
 }

System.out.print("\n");
i++;
}
}
}


Publisher: Brijmohan Lal Sahu - 1:54 AM
, , ,

Number Pattern 1 by do while loop


Code Box by do while loop
------------------------------
/*program to print number pattern square box by do while loop

  12345
  12345
  12345
  12345
  12345

*/

class npat1do
{
public static void main(String a[])
{
int n,i,j;
i=1;
n=Integer.parseInt(a[0]);

do
{j=1;
        do
 {
        System.out.print(j);
        j++;
 }
 while(j<=n);
        
System.out.print("\n");
i++;
}
while(i<=n);

}


}


Publisher: Brijmohan Lal Sahu - 1:50 AM
, , ,

Number Pattern 2 by while loop


Code Box by while loop
-----------------------------
/*program to print number pattern box by while loop

  1
  12
  123
  1234
  12345

*/

class npat2w
{
public static void main(String a[])
{
int n,i,j;
i=1;
n=Integer.parseInt(a[0]);

while(i<=n)
{j=1;
        while(j<=i)
        {
        System.out.print(j);
        j++;
 }

System.out.print("\n");
i++;
}
}
}

Publisher: Brijmohan Lal Sahu - 1:44 AM
, , , ,

Number Pattern 2 by do while loop


Code Box by do while loop
---------------------------------
/*program to print number pattern by do while loop

  1
  12
  123
  1234
  12345

*/

class npat2do
{
public static void main(String a[])
{
int n,i,j;
i=1;
n=Integer.parseInt(a[0]);

do
{j=1;
        do
        {
        System.out.print(j);
        j++;
 }
 while(j<=i);

System.out.print("\n");
i++;
}
while(i<=n);

}
}

Publisher: Brijmohan Lal Sahu - 1:41 AM
, , , , , ,

Number Pattern 3 by while loop,


Code Box by while loop
-------------------------------
/*program to print number pattern  by while loop

  1
  22
  333
  4444
  55555

*/

class npat3w
{
public static void main(String a[])
{
int n,i,j;
i=1;
n=Integer.parseInt(a[0]);

while(i<=n)
{j=1;
        while(j<=i)
        {
        System.out.print(i);
        j++;
}

System.out.print("\n");
i++;
}
}
}

Publisher: Brijmohan Lal Sahu - 1:25 AM
, , , ,

Number Pattern 3 by do while loop


Code Box by do while loop
------------------------------
/*program to print number pattern  by do while loop

  1
  22
  333
  4444
  55555

*/

class npat3do
{
public static void main(String a[])
{
int n,i,j;
i=1;
n=Integer.parseInt(a[0]);

do
{j=1;
        do
        {
        System.out.print(i);
        j++;
}
while(j<=i);
System.out.print("\n");
i++;
}
while(i<=n);
}
}


Publisher: Brijmohan Lal Sahu - 1:22 AM
, , , ,

Number Pattern 4 by while loop


Code Box by while loop
-----------------------------
/*program to print star pattern square box by while loop

  11111
  22222
  33333
  44444
  55555

*/

class npat4w
{
public static void main(String a[])
{
int n,i,j;
i=1;
n=Integer.parseInt(a[0]);

while(i<=n)
{j=1;
        while(j<=n)
        {
        System.out.print(i);
        j++;
}

System.out.print("\n");
i++;
}

}
}

Publisher: Brijmohan Lal Sahu - 1:13 AM
, , ,

Number pattern 4 by do while loop


Code Box by do while loop
------------------------------
/*program to print number pattern square box by do while loop

  11111
  22222
  33333
  44444
  55555

*/

class npat4do
{
public static void main(String a[])
{
int n,i,j;
i=1;
n=Integer.parseInt(a[0]);

do
{j=1;
        do
        {
        System.out.print(i);
        j++;
}
while(j<=n);
System.out.print("\n");
i++;
}
while(i<=n);
}
}


Publisher: Brijmohan Lal Sahu - 1:10 AM
, , ,

Number Pattern 5 by while loop


Code Box by while loop
--------------------------

/*program to print number pattern square box by while loop

  54321
  54321
  54321
  54321
  54321
  

*/

class npat5w
{
public static void main(String a[])
{
int n,i,j;
i=1;
n=Integer.parseInt(a[0]);

while(i<=n)
{j=n;
        while(j>=1)
        {
        System.out.print(j);
        j--;
}

System.out.print("\n");
i++;
}
}
}



Publisher: Brijmohan Lal Sahu - 1:03 AM
, ,

Number Pattern 5 by do while loop


Code Box by do while loop
----------------------------
/*program to print star pattern square box by do while loop

  54321
  54321
  54321
  54321
  54321
  

*/

class npat5do
{
public static void main(String a[])
{
int n,i,j;
i=1;
n=Integer.parseInt(a[0]);

do
{j=n;
        do
        {
        System.out.print(j);
        j--;
}
while(j>=1);

System.out.print("\n");
i++;
}
while(i<=n);
}
}


Publisher: Brijmohan Lal Sahu - 12:59 AM
, , ,

Number Pattern 6 by while loop


Code Box by while loop
-------------------------
/*program to print star pattern square box by while loop

  55555
  44444
  33333
  22222
  11111
  

*/

class npat6w
{
public static void main(String a[])
{
int n,i,j;

n=Integer.parseInt(a[0]);
i=n;
while(i>=1)
{j=1;
        while(j<=n)
        {
        System.out.print(i);
        j++;
}

System.out.print("\n");
i--;
}
}
}


Publisher: Brijmohan Lal Sahu - 12:51 AM
, , ,

Number Pattern 6 by do while loop


Code Box by do while loop
----------------------------
/*program to print star pattern square box by do while loop

  55555
  44444
  33333
  22222
  11111
  

*/

class npat6do
{
public static void main(String a[])
{
int n,i,j;

n=Integer.parseInt(a[0]);
i=n;
do
{j=1;
        do
        {
        System.out.print(i);
        j++;
}
while(j<=n);
System.out.print("\n");
i--;
}
while(i>=1);
}
}


Publisher: Brijmohan Lal Sahu - 12:49 AM
, ,

Number Pattern 7 by while loop


Code Box by while loop
-------------------------
/*program to print star pattern square box by while loop

  1
  21
  321
  4321
  54321

*/

class npat7w
{
public static void main(String a[])
{
int n,i,j;
i=1;
n=Integer.parseInt(a[0]);

while(i<=n)
{j=i;
        while(j>=1)
        {
        System.out.print(j);
        j--;
}

System.out.print("\n");
i++;
}
}
}


Publisher: Brijmohan Lal Sahu - 12:39 AM
, ,

Number Pattern 7 by do while loop


Code Box by do while loop
---------------------------
/*program to print star pattern square box by do while loop

  1
  21
  321
  4321
  54321

*/

class npat7do
{
public static void main(String a[])
{
int n,i,j;
i=1;
n=Integer.parseInt(a[0]);

do
{j=i;
        do
        {
        System.out.print(j);
        j--;
}
while(j>=1);
System.out.print("\n");
i++;
}
while(i<=n);
}


}



Publisher: Brijmohan Lal Sahu - 12:35 AM

Thursday, October 30, 2014

, ,

Number Pattern 8 by while loop

CODE BOX
------------------------------------------------------------

/*program to print star pattern square box by while loop

  5
  54
  543
  5432
  54321

*/

class npat8w
{
public static void main(String a[])
{
int n,i,j;
n=Integer.parseInt(a[0]);
i=n;
while(i>=1)
{j=n;
        while(j>=i)
        {
        System.out.print(j);
        j--;
 }

System.out.print("\n");
i--;
}
}
}


Publisher: Brijmohan Lal Sahu - 6:06 AM
,

Number Pattern 8 by do while loop

CODE BOX 
------------------------------------------------------------

/*program to print star pattern square box by do while loop

  5
  54
  543
  5432
  54321

*/

class npat8do
{
public static void main(String a[])
{
int n,i,j;
n=Integer.parseInt(a[0]);
i=n;
do
{j=n;
        do
        {
        System.out.print(j);
        j--;
 }
 while(j>=i);
System.out.print("\n");
i--;
}
while(i>=1); 

}
}


Publisher: Brijmohan Lal Sahu - 6:04 AM
, ,

Number Pattern 9 by while loop

CODE BOX
-----------------------------------------------------


/*program to print star pattern square box by while loop

        1
       12
      123
     1234
    12345

*/

class npat9w
{
public static void main(String a[])
{
int n,i,j,k;
i=1;
n=Integer.parseInt(a[0]);

while(i<=n)
{j=n;
k=1;
        while(j>i)
        {
        System.out.print(" ");
        j--;
 }

        while(k<=i)
        {
        System.out.print(k);
 k++;
        }
System.out.print("\n");
i++;
}
}
}

Publisher: Brijmohan Lal Sahu - 5:55 AM
,

Number Pattern 9 by do While Loop

CODE BOX 
--------------------------------------------------

/*program to print star pattern square box by do while loop

        1
       12
      123
     1234
    12345

*/

class npat9do
{
public static void main(String a[])
{
int n,i,j,k;
i=1;
n=Integer.parseInt(a[0]);

do
{j=n;
k=1;
        do
        {
        System.out.print(" ");
        j--;
 }
 while(j>=i);

        do
        {

        System.out.print(k);
 k++;
        }
 while(k<=i);
System.out.print("\n");
i++;
}
while(i<=n);

}
}



Publisher: Brijmohan Lal Sahu - 5:52 AM
,

Number Pattern 10 by do while loop


----------------------------------------------
/*program to print star pattern square box by do 
while loop

        1
       21
      321
     4321
    54321

*/

class npat10do
{
public static void main(String a[])
{
int n,i,j,k;
i=1;
n=Integer.parseInt(a[0]);

do
{j=n;
 k=i;
        do
        {
        System.out.print(" ");
        j--;
 }
 while(j>=i);

        do
        {
        System.out.print(k);
        k--;
 }
 while(k>=1);

System.out.print("\n");
i++;
}
while(i<=n);

}
}
















Publisher: Brijmohan Lal Sahu - 5:38 AM
,

Number Pattern 10 by While Loop


-----------------------------------------------------------------------
/*program to print star pattern square box by while loop

        1
       21
      321
     4321
    54321

*/

class npat10w
{
public static void main(String a[])
{
int n,i,j,k;
i=1;
n=Integer.parseInt(a[0]);

while(i<=n)
{j=n;
 k=i;
        while(j>i)
        {
        System.out.print(" ");
        j--;
 }

        while(k>=1)
        {

        System.out.print(k);
        k--;
 }
System.out.print("\n");
i++;
}
}
}

Publisher: Brijmohan Lal Sahu - 5:35 AM