Creating number or symbol patterns is used to check command of a programmer or a student on for loop. In short its done just for practicing for loop.
Here are some common number patterns :
Here are some common number patterns :
public class numPtr { public static void main( String arg[]){ for(int i=1;i<=5;i++){ for(int j=1;j<=i;j++){ System.out.print(j); } System.out.println(); } } }
Pattern 2.
To Print this pattern use the following code:
public class numPtr { public static void main( String arg[]){ for(int i=1;i<=5;i++){ for(int j=5;j>=i;j--){ System.out.print(j); } System.out.println(); } } }
Pattern 3.
To Print this pattern use the following code:
public class numPtr { public static void main( String arg[]){ for(int i=1,r=5;i<=5;i++,r--){ for(int j=1;j<=r;j++){ System.out.print(j); } System.out.println(); } } }
Pattern 4.
public class numPtr { public static void main( String arg[]){ int ck=0,c=2; while(c>0){ if(ck==0){ for(int i=1;i<=5;i++){ for(int j=1;j<=i;j++){ System.out.print(j); } System.out.println(); } ck++; } else{ for(int i=1,r=5-1;i<=5-1;i++,r--){ for(int j=1;j<=r;j++){ System.out.print(j); } System.out.println(); } } c--; } } }Pattern 5.
public class numPtr { public static void main( String arg[]){ int ck=0,c=2; while(c>0){ if(ck==0){ for(int i=1,r=5;i<=5;i++,r--){ for(int j=1;j<=r;j++){ System.out.print(j); } System.out.println(); } ck++; } else{ for(int i=2;i<=5;i++){ for(int j=1;j<=i;j++){ System.out.print(j); } System.out.println(); } } c--; } } }Author Note: All the above examples gives output till 5, you can change it accordingly by changing the conditions.
1223 Comments Leave new
«Oldest ‹Older 601 – 800 of 1223 Newer› Newest»please give me the source code for displaying the following pattern
Reply123454321
1234 4321
123 321
12 21
1 1
sir please tell me how to make swastika sign by using numbers 1 to 5
Replysir please tell me how to make swastika sign by using numbers 1 to 5
Replypls help me solve this pattern-:
Reply9 7 5 3 1
..7 5 3 1
....5 3 1
......3 1
........1
1 1 1 1 1
thank you
I want solution for this
Reply1
10
101
1001
10001
It's not working
ReplyPlease give the code for this
Reply1
2 3 4
5 6 7 8 9
10 11 12 13 14 15 16
Hi Suchita try this code.
Replyimport java.util.*;
import java.io.*;
import java.util.Scanner;
public static void main(String args[])
{
int i,j,n,p=1,odd=1;
System.out.println("Enter Rows ");
Scanner s=new Scanner(System.in);
n=s.nextInt();
for(i=1;i<=n;i++)
{
for(j=1;j<=odd;j++)
{
System.out.println(p++);
}
System.out.println("");
odd=odd+2;
}
}
Hello, please can you help me out with this program :-)
ReplyIf n=7
A _ _ _ 1 _ _ _ A
B _ _ 2 _ 3 _ _ B
C _ 4 _ _ _ 5 _ C
D 6 _ _ _ _ _ 7 D
E _ 8 _ _ _ 9 _ E
F _ _ 10 _ 11 _ _ F
G _ _ _ 12 _ _ _ G
what is the code for getting this output
Reply1
2 3
6 5 4
7 8 9 10
14 13 12 11
I want this kind of output but in triangle pattern...
Replyplzz give me the solution
2
4 6
8 10 12
14 16 18 20
plz tell me how to print this pattern
Reply999999999999999999
88888888 88888888
7777777 7777777
55555 55555
4444 4444
333 333
22 22
1 1
pls help me with these #@@@@#
ReplySIR PLEASE GIVE ME THE SOLUTION
Reply1
1 0 2
1 0 2 0 3
1 0 2 0 3 0 4
1 0 2 0 3
1 0 2
1
i want pattern of
Reply1
121
12321
till n lines
code for this pattern??
Reply1
3 5
7 9 11
what about this pattern:
Reply11111
2222
333
44
5
I need this type
Reply1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Please solve this pattern
Reply#$#$#
#$#$
#$#
#$
#
Hi I need to print
Reply1
2*3
4*5*6
7*8*9*10
7*8*9*10
4*5*6
2*3
1
This particular pattern is not solved earlier
*&&*
Reply?**?
?**?
*&&*
what about this pattern:
Reply11111
2222
333
44
5
how to print..
Reply1
32
654
10987
Hello there...
ReplyPlease try out this code:
class Pattern4
{
public static void main ()
{
for (int i=0;i<5;i++)
{
for (int j=1;j<=5-i;j++)
{
System.out.print(j);
}
for (int space=1;space<=i;space++)
{
System.out.print(" ");
}
for (int k=5-i;k>=1;k--)
{
System.out.print(k);
}
System.out.println();
}
}
}
Hello there...
ReplyTry this:
class CodeNirvana
{
public static void main(int n)
{
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(i);
}
System.out.println();
}
}
}
Hello there...
ReplyHere you go....
class CodeNirvana2
{
public static void main(int n)
{
for(int i=1;i<=n;i++)
{
for(int space=0;space<=i;space++)
{
System.out.print(" ");
}
for(int num=1;num<=n-i+1;num++)
{
System.out.print(num);
}
System.out.println();
}
}
}
Hey how to print the following pattern:
Reply* *
* *
*
* *
* *
1 2 3 4 5 4 3 2 1
Reply1 2 3 4 4 3 2 1
1 2 3 3 2 1
1 2 2 1
1 1
Sir can you tell me what will be the code of above pattern?
Hi can you kindly help me with this java code the (.) are spaces
Reply......1
.....12
....123
...1234
And this one please
Reply....1
...1 2
..1 2 3
.1 2 3 4
sir please help me fast with this program
Reply**
****
********
****************
********************************
1
Reply23
456
78910
1112131415
Hi Sir,
ReplyCan you please give me the code for the pattern
----------------11
-------------11 10 11
----------11 10 9 10 11
-------11 10 9 8 9 10 11
please can you help to the earliest possible. It would be great help Sir.
Thanks in advance.
i can want print in
Reply55555
4444
333
22
1
what is the code to print for this pattern???????????
Reply1
3 5
7 9 11 13
print below pattern in java code
Reply*
++
***
++++
*****
please reply soon
if user input 3 then it should print like this
Reply*
***
*
if 5 then,
*
***
*****
***
*
please send me the code
1
Reply2*3
4*5*6
7*8*9*10
4*5*6
2*3
1
plz help me for following pattern
Reply2
4 4 4
6 6 6 6 6
8 8 8 8 8 8 8
class Pattern {
public static void main (String args[]){
for(int i=1,r=1;i<=5;i++,r++){
for(int j=1;j<=i;j++){
System.out.print(j);
}
if(r!=0){System.out.print(" ");}
for(int k=r;k>=1;k--){
System.out.print(k);
}
System.out.println(); }
}
}
class Pattern {
Replypublic static void main (String args[]){
for(int i=1,r=1;i<=5;i++,r++){
for(int j=1;j<=i;j++){
System.out.print(j);
}
if(r!=0){System.out.print(" ");}
for(int k=r;k>=1;k--){
System.out.print(k);
}
System.out.println(); }
}
}
my pattern is :
Reply1 2 4 7 11
3 5 8 12
6 9 13
10 14
15
sir, the patterns are not coming horizontal, it comes as vertical. please help
Replysir, the patterns are not coming horizontal, it comes as vertical. please help
Reply1
Reply122
122333
1223334444
give me the code for this pattern
1
Reply122
122333
1223334444
give me the code for this pattern
pls solve this pattern
Reply@ @
@ @
@ @
@
@ @
@ @
@ @
123456787654321
Reply1234567_7654321
123456___654321
12345_____54321
1234_______4321
123_________321
12___________21
1_____________1
Hi could you help me to figure out the code for this:
Reply1
123
12345
123
1
for odd number
now for even number:
1
123
123
1
Diamond shaped with user input
Sir please me in this pattern.
Reply-------1
------232
-----34545
----4567654
---567898765
--67890109876
-7890123210987
890123454321098
Sir could you help me out with this pattern printing
Reply* * * * * * *
* * or * *
* * * * * * *
i need some help, we are hosting an java event at our college ..
Replyin our event who can find out more bugs in the program he/she wins the contest, so a simple and big program containing more errors but with complex logic..
so please help us ... our event date is on 14/03/2016.
4321
Reply432
43
4
and
4321
321
21
1
Can you help me please ? thank you
4321
Reply432
43
4
and
4321
321
21
1
Can you help me please ? thank you
/*
Reply/4321
/321
/21
/1
*/
import java.util.Scanner;
class program
{
public static void main(String [ ] args)//n is 4 here.
{
System.out.print ("Enter Range: ");
Scanner sx=new Scanner(System.in);
int n=sx.nextInt();
for(int i=1;i<=n;i++)
{
for(int j=n-i+1;j>=1;j--)
System.out.print(j);
System.out.println();
}
}
}
/*
/4321
/432
/43
/4
*/
import java.util.Scanner;
class OK
{
public static void main(String [ ] args)
{
System.out.println(" Enter Range");
Scanner ab=new Scanner (System.in);
int n=ab.nextInt();
for(int i=1;i<=n;i++)
{
for(int j=n;j>=i;j--)
System.out.print (j);
System.out.println();
}
}
}
/*
Reply/4321
/321
/21
/1
*/
import java.util.Scanner;
class program
{
public static void main(String [ ] args)//n is 4 here.
{
System.out.print ("Enter Range: ");
Scanner sx=new Scanner(System.in);
int n=sx.nextInt();
for(int i=1;i<=n;i++)
{
for(int j=n-i+1;j>=1;j--)
System.out.print(j);
System.out.println();
}
}
}
/*
/4321
/432
/43
/4
*/
import java.util.Scanner;
class OK
{
public static void main(String [ ] args)
{
System.out.println(" Enter Range");
Scanner ab=new Scanner (System.in);
int n=ab.nextInt();
for(int i=1;i<=n;i++)
{
for(int j=n;j>=i;j--)
System.out.print (j);
System.out.println();
}
}
}
1
Reply32123
4321234
543212345
4321234
32123
212
1
1
Reply212
32123
4321234
543212345
4321234
32123
212
1
123
Reply123
123
123
Reply123
123
123
Reply123
123
What will be the code for
Reply*
***
*****
*******
*********
This the required code
This the required code
class j
{
public void main()
{//upper part
int i=1;int p=5;
for(i=1;i<=p;i++)
{int l=i;
if(l>1)
{
for(;l>=1;l--)
{System.out.print(l);
}
for(int k=2;k<=i;k++)
{
System.out.print(k);
}
}
else
System.out.print(1);
System.out.println();
}
//lower part
for(int a=4;a>=1;a--)
{
int b=a;
if(b>1)
{
for(;b>=1;b--)
{
System.out.print(b);
}
for(int k=2;k<=a;k++)
{
System.out.print(k);
}
}
else
System.out.print(1);
System.out.println();
}}}
class j
{
public void main()
{//upper part
int i=1;int p=5;
for(i=1;i<=p;i++)
{int l=i;
if(l>1)
{
for(;l>=1;l--)
{System.out.print(l);
}
for(int k=2;k<=i;k++)
{
System.out.print(k);
}
}
else
System.out.print(1);
System.out.println();
}
//lower part
for(int a=4;a>=1;a--)
{
int b=a;
if(b>1)
{
for(;b>=1;b--)
{
System.out.print(b);
}
for(int k=2;k<=a;k++)
{
System.out.print(k);
}
}
else
System.out.print(1);
System.out.println();
}}}
class j
{
public void main()
{
int i =1;
int j=3;
int k=1;
for(i=1;i<=j;i++)
{
for( k=1;k<=j;k++)
{
System.out.print(k);
}
System.out.println();
}
}
hi sir can please send the code for this diamond format:
Reply1
2 3
4 5 6
7 8
9
hi sir can u please write the code for the below format
Reply1
2 3
4 5 6
7 8
9
this pattern is in diamond shape
ReplyPlease help me out with this program:
ReplyIf number of rows = 5,
1
1 2
1 2 5
1 2 5 12
1 2 5 12 29
1 2 5 12 29 70
int value=1;
ReplySystem.out.println("Enter row count");
Scanner in=new Scanner(System.in);
int n=in.nextInt();
int space=n-1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= space; j++)
System.out.print(" ");
space--;
for (int k=1;k<=i;k++){
System.out.print(value+" ");
value++;
}
System.out.println();
}
int count=1;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= count; j++)
System.out.print(" ");
count++;
for (int k = 1; k <=n-i; k++)
{
System.out.print(value+" ");;
value++;
}
System.out.println();
}
}
}
hi , can you make a code of this one.
Reply3
3 3
3 3 3
3 3 3 3
public class stars {
Replypublic static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("enter n");
int n= in.nextInt();
for (int i=0;i<=n;i++){
for (int j=0;j<=i;j++){
System.out.print("3");
}
System.out.println();
}
}
}
Hi sir i got the pgm for how to print the this diamond pattern .can u please write the code for adding the column elements for this pattern
Replyplzzzz tell me code of this pattern
Reply2
2 4
2 4 6
2 4 6 8
2 4 6 8 10
plzzzz tell me code of this pattern
Reply2
2 4 6
2 4 6 8
2 4 6 8 10
Hey!
ReplyKindly tell how to code this pattern?
5 4 3 2 1
10 8 6 4 2
15 12 9 6 3
Hey the output is
Reply1
01
010
1010
10101
Hello, sir plz help me for the following pattern
Reply1
2 4
1 3 5
2 4 6 8
1 3 5 7 9
Hello, sir plz help me for the following pattern
Reply1
2 4
1 3 5
2 4 6 8
1 3 5 7 9
class k
Reply{
public void main()
{
for(int i=1;i<=5;i++)
{int c=1;
if(i%2==0)
{
for(int j=2;c<=i;j=j+2,c++)
{
System.out.print(j);
}
}
else
{
for(int j=1;c<=i;j=j+2,c++)
{
System.out.print(j);
}
}
System.out.println();
c=1;
}
}
}
class k
Reply{
public void main()
{
int k=0;
for(int i=1;i<=5;i++)
{
if(i==1){
k=1;
System.out.print(k);
System.out.println();
k=0;
continue;
}
int c=1;
if(i==4||i==5)
{
for(int j=1;c<=i;c++)
{
if(j==0)
{
System.out.print(j);
j=1;
}
else if(j==1)
{
System.out.print(j);
j=0;
}
}
}
else
{
for(int j=0;c<=i;c++)
{
if(j==0)
{
System.out.print(j);
j=1;
}
else if(j==1)
{
System.out.print(j);
j=0;
}
}
}
System.out.println();
c=1;
}
}
}
class k
Reply{
public void main()
{
int k=0;
for(int i=1;i<=5;i++)
{
if(i==1){
k=1;
System.out.print(k);
System.out.println();
k=0;
continue;
}
int c=1;
if(i==4||i==5)
{
for(int j=1;c<=i;c++)
{
if(j==0)
{
System.out.print(j);
j=1;
}
else if(j==1)
{
System.out.print(j);
j=0;
}
}
}
else
{
for(int j=0;c<=i;c++)
{
if(j==0)
{
System.out.print(j);
j=1;
}
else if(j==1)
{
System.out.print(j);
j=0;
}
}
}
System.out.println();
c=1;
}
}
}
Hi sir i need code for this pattern using java .
Reply1827364554637281
17263544536271
162534435261
1524334251
14233241
132231
1221
11
Hi! Can I get a solution for the following pattern:
ReplyA
Z Y
B C D
X V U W
E F G H I
Please Help me with this
ReplyA B C
A B C
A B C
and
11 12 13
21 22 23
31 32 33
Thanks
Please help me with
ReplyA B C
A B C
A B C
and
11 12 13
21 22 23
31 32 33
public class PrintSquarePattern { // Save as "PrintSaurePattern.java"
Replypublic static void main(String[] args) {
int size = 9;
System.out.println("---------------------------");
System.out.println("Pattern: a");
System.out.println("---------------------------");
System.out.println("");
for (int i= 1; i <= size; i++) { // Outer loop to print all the rows
for (int j = 1; j <= size; j++) { // Inner loop to print all the columns of each row
if((i==1)|| (i==size)||(j==1)||(j==size))
{
System.out.print("1");
}
else
if((i==2)|| (i==size-1)||(j==2)||(j==size-1))
System.out.print("2");
else
if((i==3)|| (i==size-2)||(j==3)||(j==size-2))
System.out.print("3");
else
if((i==4)|| (i==size-3)||(j==4)||(j==size-3))
System.out.print("4");
else
if((i==5)|| (i==size-4)||(j==5)||(j==size-4))
System.out.print("5");
else
System.out.print(" ");
System.out.print(" ");
}
// A row ended, bring the cursor to the next line
System.out.println();
}
}
}
public class PrintSquarePattern { // Save as "PrintSaurePattern.java"
Replypublic static void main(String[] args) {
int size = 5;
System.out.println("---------------------------");
System.out.println("Pattern: a");
System.out.println("---------------------------");
System.out.println("");
for (int i= 1; i <= size; i++) { // Outer loop to print all the rows
for (int j = 1; j <= size; j++) { // Inner loop to print all the columns of each row
if((i==1)|| (i==size)||(j==1)||(j==size))
System.out.print("1");
else
System.out.print("0");
System.out.print(" ");
}
// A row ended, bring the cursor to the next line
System.out.println();
}
}
}
public class PrintSquarePattern { // Save as "PrintSaurePattern.java"
Replypublic static void main(String[] args) {
int size = 5, size1=5;
for (int i= 1; i <=size1; i++) { // Outer loop to print all the rows
for (int j = 1; j <= size; j++) { // Inner loop to print all the columns of each row
System.out.print(i);
System.out.print(" ");
}
// A row ended, bring the cursor to the next line
System.out.println();
size=size-1;
}
}
}
public class PrintSquarePattern { // Save as "PrintSaurePattern.java"
Replypublic static void main(String[] args) {
int size = 5, size1=5;
for (int i= 1; i <=size1; i++) { // Outer loop to print all the rows
for (int j = 1; j <= size; j++) { // Inner loop to print all the columns of each row
System.out.print(i);
System.out.print(" ");
}
// A row ended, bring the cursor to the next line
System.out.println();
size=size-1;
}
}
}
public class PrintSquarePattern { // Save as "PrintSaurePattern.java"
Replypublic static void main(String[] args) {
int size = 7; //max no. of series
for(int i=1;i<=size;i++){
for(int j=1;j <=i;j++){
System.out.print("*");
}
System.out.println();
i=i+1;
}
for(int i=size-2;i>=1;i--){
for(int j=1;j <=i;j++){
System.out.print("*");
}
System.out.println();
i=i-1;
}
}
}
public class PrintSquarePattern { // Save as "PrintSaurePattern.java"
Replypublic static void main(String[] args) {
int size = 4; //max no. of series
for(int i=size;i>=1;i--){
for(int j=1;j <=i;j++){
System.out.print(i+" ");
}
System.out.println();
// i=i+1;
}
for(int i=2;i<=size;i++){
for(int j=1;j <=i;j++){
System.out.print(i+ " ");
}
System.out.println();
// i=i-1;
}
}
}
public class PrintSquarePattern { // Save as "PrintSaurePattern.java"
Replypublic static void main(String[] args) {
int size = 4; //max no. of series
for(int i=size;i>=1;i--){
for(int j=1;j <=i;j++){
System.out.print(i+" ");
}
System.out.println();
// i=i+1;
}
for(int i=2;i<=size;i++){
for(int j=1;j <=i;j++){
System.out.print(i+ " ");
}
System.out.println();
// i=i-1;
}
}
}
public class PrintSquarePattern { // Save as "PrintSaurePattern.java"
Replypublic static void main(String[] args) {
int size = 4; //max no. of series
for(int i=size;i>=1;i--){
for(int j=1;j <=i;j++){
System.out.print(i+" ");
}
System.out.println();
//i=i-1;
}
for(int i=2;i<=size;i++){
for(int j=2;j<=i+1;j++){
System.out.print(i+" ");
}
System.out.println();
// i=i+1;
}
}
}
public class PrintSquarePattern { // Save as "PrintSaurePattern.java"
Replypublic static void main(String[] args) {
int size = 5; //max no. of series
for(int i=1;i<=size;i++){
for(int j=i;j <=size;j++){
System.out.print(j+" ");
}
System.out.println();
// i=i+1;
}
}
}
public class PrintSquarePattern { // Save as "PrintSaurePattern.java"
Replypublic static void main(String[] args) {
int size = 5; //max no. of series
int i;
for( i=size;i>=1;i--){
for(int j=1;j <=i;j++){
System.out.print(j+" ");
}
for(int j=i;j >=1;j--){
System.out.print(j+ " ");
}
System.out.println();
}
}
}
public class PrintSquarePattern { // Save as "PrintSaurePattern.java"
Replypublic static void main(String[] args) {
int size = 5; //max no. of series
int i;
for( i=1;i<=size;i++){
for(int j=1;j <=i;j++){
System.out.print(j+" ");
}
for(int j=i;j >=1;j--){
System.out.print(j+ " ");
}
System.out.println();
}
}
}
public class JavaCodez { // Save as "JavaCodez.java"
Replypublic static void main(String[] args) {
int size = 9; //max no. of series
for(int i=1;i<=size;i++){
for(int j=1;j <=i;j+=2){
System.out.print(j+" ");
}
System.out.println();
i=i+1;
}
}
}
public class JavaCodez { // Save as "JavaCodez.java"
Replypublic static void main(String[] args) {
int size = 5;
for (int i= 1; i <=5; i++) { // Outer loop to print all the rows
for (int j = 1; j <=i; j++) { // Inner loop to print all the columns of each row
System.out.print(size);
System.out.print(" ");
}
// A row ended, bring the cursor to the next line
System.out.println();
size=size-1;
}
}
}
public class JavaCodez{ // Save as "JavaCodez.java"
Replypublic static void main(String[] args) {
int size = 5; //max no. of series
for(int i=1;i<=size;i++){
for (int k=1;k<=i;k++)
{
System.out.print(i+" ");
}
for(int j=i+1;j <=size;j++){
System.out.print(j+" ");
}
System.out.println();
}
}
}
1
Reply232
34543
4567675
and
1
0 1
1 0 1
0 1 0 1
1 0 1 0 1
1
Reply0 1
1 0 1
0 1 0 1
1 0 1 0 1
and
1
232
34543
4567675
1
Reply0 1
1 0 1
0 1 0 1
1 0 1 0 1
and
1
232
34543
4567675
1
Reply232
34543
4567675
and
1
0 1
1 0 1
0 1 0 1
1 0 1 0 1
1
Reply32
543
7654
Thanks
WHAT WILL BE THE OUTPUT FOR
Reply13579
35791
57913
79135
91357
class pattern
Reply{
public static void main(String args[])
{
int r=0,c=0;
for(r=1;r<=5;r++)
{
for(c=1;c<=r;c++)
{
System.out.print(c);
}
for(c=r;c>=1;c--)
{
System.out.print(c);
}
System.out.println();
}
}
}
Here's the code for the program you mentioned :
Replyclass pattern
{
public static void main(String args[])
{
int r=0,c=0;
for(r=1;r<=5;r++)
{
for(c=1;c<=r;c++)
{
System.out.print(c);
}
for(c=r;c>=1;c--)
{
System.out.print(c);
}
System.out.println();
}
}
}
P
ReplyPR
PRI
PRIT
PRITI
Sir can you please give me the code for this......thank you:)
Reply1
2 4
1 3 5
2 4 6 8
1 3 5 7 9
Sir can you please give me the code for this......thank you:)
Reply1
2 4
1 3 5
2 4 6 8
1 3 5 7 9
How to solve this program
ReplyO o
Ob. bo
Obj. jbo
Obje ejbo
Objec cejbo
Objectcejbo
Objec cebjo
Obje. ejbo
Obj. jbo
Ob. bo
O. O
public class Sumit {
Replypublic static void main( String arg[]){
for(int i=1 ; i<=5 ; i++){
/*for(int k=5-i ; k<4 ; k++){
System.out.print(" ");
}*/
for(int j=i ; j<=5 ; j++){
System.out.print(j);
}
System.out.println();
}
}
}
Hey this should be the correct pattern to your requirement ,
ReplyOutput for ---
11111112
32222222
33333334
54444444
55555556
76666666
-----------------
Executed properly ,any input you can give.
public class comment
{
public static void main (String args[])
{
int n = 6; //change to ypur requirement(should be even nos)
int count1=1,count2=2,x=n;
while(x>0){
for(int i=1;i<n;i++){
System.out.print(count1);
}
count1++;
System.out.print(count2++);
System.out.println();
System.out.print (count2++);
for(int j=1;j<n;j++){
System.out.print(count1);
}
System.out.println();
count1++;
x-=2;
}
}
}
can you tell me the program accept a number x from the user and number on terms n also from the user
Replyand find
x!/10 + (x+2)!/15 + (x+4)!/20 .... till n terms
can you tell me the program accept a number x from the user and number on terms n also from the user
Replyand find
x!/10 + (x+2)!/15 + (x+4)!/20 .... till n terms
help me for this pattern....
Reply"1357
135
13
1"
1
Reply23
4567
89123456
7891234567891234
How can i print the numbers?
5
Reply5 4
5 4 3
5 4 3 2
5 4 3 2 1
5 4 3 2
5 4 3
5 4
5
hi sir u r just great in this . i want to ask how to create logic for making patterns. give me an example plzzz if u can .how to start making logic
Replyhi sir u r just great in this . i want to ask how to create logic for making patterns. give me an example plzzz if u can .how to start making logic
Reply1
Reply1 2 3
1 2 3 4 5
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 9
mobulous software pvt. ltd. program for aptitude.
what is the code for this pattern
Reply1
2 3
3 4 5
5 6 7 8
8 9 10
10 11
11
Kindly Help Me
ReplyGive me Code to print This type of pattern...
1
3 2
4 5 6
10 9 8 7
11 12 13 14 15
1
Reply123
12345
1234567
12345
123
How to solved it plzzzzzzzzz
1
Reply123
12345
1234567
12345
123
1
plesae genarate code in java help me
int i,j;
Replyfor(i=1 ; i<=5 ; i++){
for(j=i;j<=5;j++)
System.out.print(j);
System.out.print("\n");
}
why did you use k there? could you please explain me? because mine is working properly.
how to print the pattern :-\
Reply1
3 1
5 3 1
7 5 3 1
9 7 5 3 1
how to print the pattern :-\
Reply1
3 1
5 3 1
7 5 3 1
9 7 5 3 1
Sir Please solve this program
Replyinput:Hi Sir this is pattern code
output:H i i t
package Basic;
Reply/**
* program to display above pattern in java
* @author SK
* */
public class NumberPatterns {
public static void main(String[] args) {
/*---------first part----------------*/
for(int i=5;i>=1;i--){
for(int j=1;j<=i;j++){
if(j<=i)
System.out.print(j+" ");
else
System.out.print(" ");
}
for(int k=4;k>=1;k--){
if(k>i)
System.out.print(" ");
else
System.out.print(k+" ");
}
System.out.println();
}
/*---------second part----------------*/
}
}
1
Reply2 4 6
1 3 5 7 9
2 4 6 8 10 12 14
please give the code for
Reply0
10
101
0101
01010
and
1
0 1
0 10
1 010
1 0101
5
Reply4 4
3 3 3
2 2 2 2
1 1 1 1 1
2 2 2 2
3 3 3
4 4
5
5
Reply4 4
3 3 3
2 2 2 2
1 1 1 1 1
2 2 2 2
3 3 3
4 4
5
what is the code for this?
Reply1
2 4
1 3 5
2 4 6 8
1 3 5 7 9
2 4 6 8 10 12
1 3 5 7 9 11 13
What is the code for this pattern?
Reply1
2 4
1 3 5
2 4 6 8
1 3 5 7 9
2 4 6 8 10 12
in traingle pattern only
Replyhere is the simple code
Replyclass NumberPattern
{
public static void main( String arg[]){
for(int i=1;i<=5;i++)
{
for(int j=i;j<=5;j++)
{
System.out.print(j);
}
System.out.println();
}
}
}
here is the solution
Replyclass NumberPattern1
{
public static void main( String arg[]){
for(int i=1;i<=5;i++)
{
for(int j=i;j<=5;j++)
{
System.out.print(j);
}
System.out.println();
}
}
}
here is the solution
Replyclass NumberPattern1
{
public static void main( String arg[]){
for(int i=1;i<=5;i++)
{
for(int j=i;j<=5;j++)
{
System.out.print(j);
}
System.out.println();
}
}
}
what will be the solution for 1
Reply2 3
4 5 6
7 8 9 10
11 12 13 14 15
using switch case
any body can give the code for following pattern..
Reply1*2*3*4*5*26*27*28*29*30
6*7*8*9*22*23*24*25
10*11*12*19*20*21
13*14*17*18
15*16
5
Reply4 4
3 3 3
2 2 2 2
1 1 1 1 1
2 2 2 2
3 3 3
4 4
5
please show me the pattern of :
Reply1
21
321
4321
54321
plzzzz tell me code of this pattern by while
Reply*
##
***
####
*****
plzzzz tell me code of this pattern by while
Reply*
##
***
####
*****
plz can u help this pattern?
Reply1
22
333
4444
55555
give me code
plz can u help this pattern?
Reply1
22
333
4444
55555
give me code
public class Pattern5 {
Replypublic static void main(String[] args) {
System.out.println("Enter a number for pattern");
Scanner scan=new Scanner(System.in);
int n=scan.nextInt();
for(int i=0;i<n;i++){
for(int j=(i+1);j<=n;j++){
System.out.print(j);
}
System.out.println();
}
}
}
write a java program
ReplyMethod should accept two parameters.
First parameter is first number to display, second parameter should be number of rows to be printed.
printseries(firstparam,secondparam)
Sample:
printseries(7,4)
Output should be:
7
14 15
28 29 30 31
56 57 58 59 60 61 62 63
Below program prints format of
Replywhat is the purpose of c=2,while(c>0) and c-- can you please explain this
12345
1234
123
12
1
12
123
1234
12345
public class numPtr {
public static void main( String arg[]){
int ck=0,c=2;
while(c>0){
if(ck==0){
for(int i=1,r=5;i<=5;i++,r--){
for(int j=1;j<=r;j++){
System.out.print(j);
}
System.out.println(); }
ck++;
} else{
for(int i=2;i<=5;i++){
for(int j=1;j<=i;j++){
System.out.print(j); }
System.out.println();
}
}
c--;
}
}
}
SIR CAN PLEASE TELL METHE CODE OF TH BLOW NUMBER PYRAMID:
Reply1
12
123
1234
SIR CAN PLEASE TELL METHE CODE OF TH BLOW NUMBER PYRAMID:
Reply1
12
123
1234
SIR CAN PLEASE TELL METHE CODE OF TH BLOW NUMBER PYRAMID:
Reply1
12
123
1234
What will be the code for:
ReplyPattern 1:
1
2 6
3 7 10
4 8 11 13
5 9 12 14 15
Pattern 2:
1
3 2
4 5 6
10 9 8 7
11 12 13 14 15
21 20 19 18 17 16
?
give me code for following patterns
Reply1.
1 3 8 15
24 35 48
63 80
99
2.
1 8 27
64 125 216
343 512 729
3.
0 2 4
6 10 12
18 22 28
30 36 40
please give it quick.....
int p = 1;
Replyfor(int i = 1; i<=3; i++)
{
for(int j=1; j<=3; j++)
{
System.out.print(p);
p++;
}
System.out.println();
}
thanks sujit
ReplySIR PLEASE SOLVE THIS PROGRAM
Reply1 2 3
8 4
7 6 5
SIR PLEASE SOLVE THIS PROGRAM
Reply1 2 3
8 4
7 6 5
need your help to print
Reply20 19 18 17 16
11 12 13 14 15
10 9 8 7 6
1 2 3 4 5
I need help please solve the pattern:-X1Z2X3Z4
ReplyX5Z6X7
X8Z9
X10
what was code for
Reply*
* *
* *
* * * *
* *
* *
Hi sir i want to print this pattern and all the 5 must be in centre line
Reply5
4 5 4
3 4 5 4 3
2 3 4 5 4 3 2
1 2 3 4 5 4 3 2 1
2 3 4 5 4 3 2
3 4 5 4 3
4 5 4
5
1
Reply2*2
3*3*3
4*4*4*4
4*4*4*4
3*3*3
2*2
1
sir i want a java program to print the pattern of even numbers
Reply2 2
4 4 4 4
6 6 6 6 6 6
1
Reply3 2 5
7 9 8 11 13
String str="asdasfwtr"; , i want to know how many times each letter is occurred in a string
Replyhow to make this without array
Reply123
8 4
765
hiii sir .........pls help me to make a pattern
Replyhow to print this..
Reply1234567
654321
12345
4321
123
21
1
pls sir help
Replyhow to print this.......
1
23
4567
89123456
7891234567891234
how to print it...
Reply12345678
8765432
234567
76543
3456
654
45
5
54321
Reply4321
321
21
1
sir pls tell me the code asap !!
please Help me
Reply1
2 3 2
3 4 5 4 3
4 5 6 7 6 5 4
5 6 7 8 9 8 7 6 5
1. print series 7,10,8,11,9,12....
ReplyI did not catch?
Replyreally helpful... :)
Replywhat is the pattern for:::::
Reply1
12
121
12321
1234321
123454321
1234321
12321
121
12
1
a a^2 a^3
Reply1 1 1
2 4 8
3 9 27
4 16 64
can i get for this 01
Reply120
130
Sir Can You please solve this program !
ReplyIf input = 4 then ,
Output:
4444444
4333334
4322234
4321234
4322234
4333334
4444444
plz help me out for this program & explain it sir!!!
Reply1
2 2
3 3 3
4 4 4 4
please help me to solve this problem!!
Reply1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
hello sir plzzz help me how to print this type.
Reply001
010
100
1 0 0 0
Reply2 2 0 0
3 3 3 0
4 4 4 4
1 0 0 0
Reply2 2 0 0
3 3 3 0
4 4 4 4
Can u pls help me in printing following pattern
Replyif input=4
1 0 0 0
2 2 0 0
3 3 3 0
4 4 4 4
Reply
public class Test {
Replypublic static void main(String[] args) {
int l=0;
for(int i=0; i<4; i++){
for(int j=0; j<4; j++){
if(l>=j){
System.out.print(l+1);
}else
System.out.print("0");
}
l++;
System.out.print("\n");
}
}
}
1234
Reply2341
3421
4321
Make sure you tick the "Notify Me" box below the comment form to be notified of follow up comments and replies.