logic for pattern program

logic for pattern program

what's the logic for create pattern program how can i create any pattern program with in minute. like this

123454321     *
1234 4321    ***
123   321   *****
12     21    ***
1       1     *

123321       1         1
12  21      1212      2323  
1    1     123123    345456
12  21    12341234  5678789
123321   1234512345

etc. i want know that how can i create this program in java without help whats the logic how can i understand that whoe's program code its make this type output

View Answers

February 24, 2011 at 1:17 PM

Java Pattern Example

 *
  * *
 * * *
  * *
   *
public class PatternExample {
public static void main(String[] args) {
int num=3;
int p = num;
int q = 0;
for (int i = 0; i <= num; i++) {
for (int j = p; j>= 1; j-- )
System.out.print(" ");
p-=1;
for (int k = 1; k <= i; k++)
System.out.print ("* ");
System.out.println();
}
num-=1;
for (int i = 0; i<=num; i++) {
for (int j = num; j > i; j--)
System.out.print (" *");
System.out.println();
for (int k = 0; k <= q; k++)
System.out.print(" ");
q+=1;
}
}
}

February 24, 2011 at 5:44 PM

Java Pattern Example:

123454321    
1234 4321    
123   321   
12     21    
1       1

public class PatternExample{
public static void main(String[] args){

int i,j,n=5;

for(i=0;i<=n;i++)
{
 System.out.println();
 for(j=1;j<=n-i;j++)
System.out.print(j);
 for(j=0;j<2*i;j++)
 System.out.print(" ");
 for(j=n-i;j>0;j--)
 System.out.print(j);
 }
}
}

July 25, 2011 at 11:00 PM

#include<stdio.h>
int main()
{
int i,j,n;
printf("Enter no");
scanf("%d",&n);
for(i=0;i<n;i++)
{
        for(j=1;j<=n-i;j++)
                printf("%d",j);
        for(j=0;j<((i*2)-1);j++)
                printf("*");
        for(j=n-i;j>0;j--)
        {
                if(j==n)
                {
                }
                else
                printf("%d",j);
        }
        printf("\n");
 }}

July 25, 2011 at 11:01 PM

#include<stdio.h>

int main()

{

int i,j,n;

printf("Enter no");

scanf("%d",&n);

for(i=0;i<n;i++)

{

        for(j=1;j<=n-i;j++)

                printf("%d",j);

        for(j=0;j<((i*2)-1);j++)

                printf("*");

        for(j=n-i;j>0;j--)

        {

                if(j==n)

                {

                }

                else



              printf("%d",j);


        }

        printf("\n");

 }}

November 2, 2012 at 1:06 PM

5 5 5 5 5 4 4 4 4 3 3 3 2 2 1

import java.io.*; class reversepattern { public static void main(String args[]) { int i,j; for(i=5;i>=1;i--) { for(j=1;j<=i;j++) { System.out.print(i); System.out.print(" "); } System.out.println(" "); } } }









Related Tutorials/Questions & Answers:
logic for pattern program
logic for pattern program  what's the logic for create pattern program how can i create any pattern program with in minute. like this 123454321... create this program in java without help whats the logic how can i understand
what's the logic for create pattern program
what's the logic for create pattern program   1 2 3 4 5 5 1 2 3 4 4 5 1 2 3 3 4 5 1 2 2 3 4 5 1
Advertisements
what is the logic of this pattern?
what is the logic of this pattern?   1 121 12321 1234321
pattern program
pattern program  can some one plz help me to wright the logic for the following pattern abcdcba abc cba ab ba a a ab ba abc cba abcdcba
pattern program
pattern program  13579 1357 135 13 1 pattern program in java   Here is your Example:- package Compare; public class PatternDemo { public static void main(String [] args){ int c=10; for(int i=0;i<
pattern program
pattern program  can any 1 print the following pattern in java .plz give the code.and yes thank u so much for answering my 2 other questions.had i... before.anyways the pattern goes like this abcdcba abc cba ab ba a a ab ba abc abc
Moire Pattern Java Program
Moire Pattern Java Program  **strong text**What you are seeing in the screenshot are two sets of concentric circles. The centers of the circles... an oval whose width and height are the same. Make the program from this older code
pattern
program displays a menu and asks the user to choose a pattern and size. But note...pattern  write a java program that can create four different patterns of different sizes. The size of each pattern is determined by the number
LOGIC
LOGIC  hey guys..i have my exams coming in somedays and it would be really helpful if someone explained how to develop the logic of any program
LOGIC
LOGIC  hey guys..i have my exams coming in somedays and it would be really helpful if someone explained how to develop the logic of any program
Pattern
Pattern  How to print this pattern in Java please help me A AC ACE ACEG ACEGI The program should be right to left
pattern
pattern  1 3 1 5 3 1 7 5 3 1 9 7 5 3   Here is a number pattern example. 1 3 1 5 3 1 7 5 3 1 9 7 5 3 1 class Pattern{ public static void main(String args[]){ for(int i=1;i<=9;i
Pleae help me to give logic and code for this program - Java Beginners
Pleae help me to give logic and code for this program  Write a function that given the string ?original? create a new string ?dramatic? that has two consecutive copies of each letter from the original string. For example
Pattern
Pattern  1234321 123 321 12 21 1 1 please,give me this pattern in java   class Sixth_1 { public static void main(String args...; } } }   Here is a number pattern class Pattern{ public
Java pattern
Java pattern  Write a Java program that outputs the following pattern. 1 21 321 4321 54321 654321
pattern printing
pattern printing  
Logic and desgin
Logic and desgin  How would this be put in visual logic symbol
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Pattern Matching
Pattern Matching  hello, What operator performs pattern matching?   hii,ADS_TO_REPLACE_1 The "LIKE" operator performs the pattern matching in SQL
Design pattern
Design pattern  explain factory pattern
Pattern Making
Pattern Making  how to print this pattern in java? * * * * * * * * * * * * * * * * * It is just an example
Pattern resetting using regular expression
the String using regular expression. For this we are going to make program named Pattern_Resetting.java. The steps involved in program Pattern_Resetting.java... Pattern resetting using regular expression  
Code for Pattern
Code for Pattern   1 23 345 5678 891011 Please write the code of above program and please do not use in this string tokennizer, string buffer etc i mean to say that please use very simple method
ModuleNotFoundError: No module named 'logic'
ModuleNotFoundError: No module named 'logic'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'logic' How to remove the ModuleNotFoundError: No module named 'logic'
ModuleNotFoundError: No module named 'Pattern'
ModuleNotFoundError: No module named 'Pattern'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'Pattern' How to remove the ModuleNotFoundError: No module named 'Pattern
ModuleNotFoundError: No module named 'Pattern'
ModuleNotFoundError: No module named 'Pattern'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'Pattern' How to remove the ModuleNotFoundError: No module named 'Pattern
ModuleNotFoundError: No module named 'Pattern'
ModuleNotFoundError: No module named 'Pattern'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'Pattern' How to remove the ModuleNotFoundError: No module named 'Pattern
ModuleNotFoundError: No module named 'Pattern'
ModuleNotFoundError: No module named 'Pattern'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'Pattern' How to remove the ModuleNotFoundError: No module named 'Pattern
Coder for Pattern
Coder for Pattern  1 12 123 1234 12345 please write the program of above pattern and do not use string tokennizer string buffer i mean to say that please use very simple method Thanks   public class PatternExample

Ads