Giter VIP home page Giter VIP logo

Comments (25)

milan604 avatar milan604 commented on July 30, 2024

package pattern18;

/**
*

  • @author m-lan
    */
    public class Pattern18 {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      char[] a = {'A', 'B', 'C', 'D'};
      int b = 0;
      for (int i = 1; i <= a.length; i++) {
      for (int j = 2; j <= i; j++) {
      System.out.printf(" ");

       }
       int c = b;
       for (int k = a.length; k >= i; k--) {
           System.out.printf("%c", a[c]);
           c++;
      
       }
       b++;
      
       for (int l = a.length; l > i; l--) {
           System.out.printf("%c", a[l - 2]);
       }
       System.out.println("");
      

      }
      }

}

screenshot from 2017-07-27 14-09-47

from java.

jagdish4249 avatar jagdish4249 commented on July 30, 2024

package pattern17;

/**
*

  • @author jagdish
    */
    public class Pattern17 {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      // TODO code application logic here
      char[] a = {'A','B','C','D'};

      int l = a.length;
      for ( int i = l; i >= 1; i--) {
      int z = l-i;
      for ( int j = l; j >= 1 ; j--) {

           if(i<j){
               System.out.print(" ");   
           }  
           else{
               System.out.print(a[z]);
                 z++;
           }   
       }
       z = l-2;
       for (int k = 1; k <= l-1; k++) {
            
            if((i-1)>=k){
               System.out.print(a[z]);
               z--;
            }
            
       }
      

      System.out.println("");
      }
      }

}

image

from java.

raBbn avatar raBbn commented on July 30, 2024

/*

  • To change this license header, choose License Headers in Project Properties.
  • To change this template file, choose Tools | Templates
  • and open the template in the editor.
    */
    package pattern19;

/**
*

  • @author Kishorr
    */
    public class Pattern19 {

    /**
    *

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      // TODO code application logic here
      char[] arr1 = {'A', 'B', 'C', 'D'};

      for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 4; j++) {
      if (j < i) {
      System.out.print(" ");
      } else {
      System.out.print(arr1[j] + " ");
      }
      }
      for (int j = 2; j >= i; j--) {
      System.out.print(arr1[j] + " ");
      }
      System.out.println("");
      }

    }

}
capture17

from java.

pujanchangubhari73 avatar pujanchangubhari73 commented on July 30, 2024

package forpattern29;

/**
*

  • @author Pujan
    */
    public class ForPattern29 {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      // TODO code application logic here
      char[] a = {'A', 'B', 'C', 'D'};
      int n = 3; //same to array length

      for (int i = 0; i <= a.length - 1; i++) {

       for (int l = 0; l <= i; l++) {
           System.out.printf(" " + " ");
       }
       for (int j = i; j <= n; j++) {
           System.out.print(a[j] + " ");
       }
      
       for (int k = n - 1; k >= i; k--) {
           System.out.print(a[k] + " ");
       }
       System.out.println();
      

      }
      }

}

image

from java.

maheshyakami avatar maheshyakami commented on July 30, 2024

/*

  • To change this license header, choose License Headers in Project Properties.
  • To change this template file, choose Tools | Templates
  • and open the template in the editor.
    */
    package pattern;

/**
*

  • @author mahesh
    */
    public class Pattern {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      // TODO code application logic here
      char[] alpha = {'A', 'B', 'C', 'D', 'E'};
      final int N = alpha.length;
      for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
      if (j < i) {
      System.out.print(" ");
      } else {
      System.out.print(alpha[j]);
      }
      }
      for (int j = N - 2; j >= i; j--) {
      System.out.print(alpha[j]);
      }
      System.out.println("");
      }
      System.out.println();

    }

}
screen shot 2017-07-27 at 5 31 08 pm

from java.

sthaanu avatar sthaanu commented on July 30, 2024

/*

  • To change this license header, choose License Headers in Project Properties.
  • To change this template file, choose Tools | Templates
  • and open the template in the editor.
    */
    package pattern20;

/**
*

  • @author admin
    */
    public class Pattern20 {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      char[] a = {'A', 'B', 'C', 'D'};
      for (int i = 0; i < a.length; i++) {
      for (int j = 0; j < a.length; j++) {
      if (j >= i) {
      System.out.print(a[j]);
      } else {
      System.out.print(" ");
      }
      }
      for (int j = a.length - 2; j >= 0; j--) {
      if (j >= i) {
      System.out.print(a[j]);
      } else {
      System.out.print(" ");
      }

       }
       System.out.println("");
      

      }
      }
      }
      capture

from java.

kiir33 avatar kiir33 commented on July 30, 2024

package pattern8;

/**
*

  • @author KIRANN
    */
    public class Pattern8 {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      // TODO code application logic here
      char[] a = {'A', 'B', 'C', 'D', 'E'};
      int i, j;
      final int N = 5

      System.out.println("Pattern 20\n----------------------");
      for (i = 0; i < N; i++) {
      for (j = 0; j < N; j++) {
      if (j < i) {
      System.out.print("\t");
      } else {
      System.out.print(a[j] + "\t");
      }
      }
      for (j = N - 2; j >= i; j--) {
      System.out.print(a[j] + "\t");
      }
      System.out.println("");
      }

    }
    }
    Output:
    capture

from java.

karmi214 avatar karmi214 commented on July 30, 2024

/*

  • To change this license header, choose License Headers in Project Properties.
  • To change this template file, choose Tools | Templates
  • and open the template in the editor.
    */
    package pattern20;

/**
*

  • @author Anish
    */
    public class Pattern20 {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      // TODO code application logic here
      char[] a = {'A', 'B', 'C', 'D'};
      for (int i = 0; i < a.length; i++) {
      for (int j = 0; j < a.length; j++) {
      if (j >= i) {
      System.out.print(a[j]);
      } else {
      System.out.print(" ");
      }
      }
      for (int j = a.length - 2; j >= 0; j--) {
      if (j >= i) {
      System.out.print(a[j]);
      } else {
      System.out.print(" ");
      }

       }
       System.out.println("");
      

      }

    }

}
p20

from java.

sajanbasnet75 avatar sajanbasnet75 commented on July 30, 2024

/*

To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
/
package assignment2;
/*
*

@author LORDsajan
*/
public class Assignment2 {

/**

@param args the command line arguments
/
public static void main(String[] args) {
System.out.println("\nPattern 20");
char[] ch = {'A', 'B', 'C', 'D'};
for (int i = 0; i < ch.length; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(" ");
}
for (int j = i; j < ch.length; j++) {
System.out.print(ch[j]);

        }
        for (int k = ch.length - 2; k >= i; k--) {
            System.out.print(ch[k]);
        }
        System.out.println(" ");
    }

}
}
20

from java.

 avatar commented on July 30, 2024

package pattern21;

/**
*

  • @author Samikshya
    */
    public class Pattern21 {

    public static void main(String[] args) {
    char n[] = {'A', 'B', 'C', 'D'};
    for (int i = 0; i < 4; i++) {
    for (int j = 0; j < i; j++) {
    System.out.print(" ");

         }
         for (int k = i; k < 4; k++) {
             System.out.print(n[k]);
    
         }
         for (int k = 2; k >= i; k--) {
             System.out.print(n[k]);
    
         }
    
         System.out.println("");
    
     }
    

    }
    }

capture

from java.

kajalmaharjan avatar kajalmaharjan commented on July 30, 2024

//PATTERN 21
char[] n5 = {'A', 'B', 'C', 'D'};
for (int i = 0; i < n5.length; i++) {
for (int j = 0; j < i; j++) {
System.out.print(" ");
}
for (int j = i; j < n5.length; j++) {
System.out.print(n5[j]);
}
for (int j = 2; j >= i; j--) {
System.out.print(n5[j]);
}
System.out.println("");
}
image

from java.

syslin avatar syslin commented on July 30, 2024

/*

  • To change this license header, choose License Headers in Project Properties.
  • To change this template file, choose Tools | Templates
  • and open the template in the editor.
    */
    package paterrn;

/**
*

  • @author dell
    */
    public class Paterrn {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      // TODO code application logic here
      System.out.println("pattern 21");
      char b[] = {'A', 'B', 'C', 'D'};
      for (int i = 0; i < b.length; i++) {
      for (int j = 0; j < b.length; j++) {
      if (j >= i) {
      System.out.print(b[j]);
      } else {
      System.out.print(" ");

           }
      
       }
      
       for (int k = b.length - 2; k >= 0; k--) {
           if (k >= i) {
               System.out.print(b[k]);
      
           } else {
               System.out.print("");
           }
       }
       System.out.println(" ");
      

      }
      }
      }
      21

from java.

RakenShahi avatar RakenShahi commented on July 30, 2024

/*

  • To change this license header, choose License Headers in Project Properties.
  • To change this template file, choose Tools | Templates
  • and open the template in the editor.
    */
    package q18;

/**
*

  • @author DELL
    */
    public class Q18 {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {

      int b = 4;
      int c = 0;

      char[] a = {'A', 'B', 'C', 'D'};
      for (int i = 0; i <= 3; i++) {

       for (int k = 0; k < i; k++) {
           System.out.printf(" ");
       }
      
       for (int j = i; j < b; j++) {
      
           System.out.printf("%c", a[j]);
      
       }
       for (int l = 2; l >= c; l--) {
           System.out.printf("%c", a[l]);
       }
       c = c + 1;
       System.out.print("\n");
      

      }

    }

}

OUTPUT
18

from java.

Roshantwanabasu avatar Roshantwanabasu commented on July 30, 2024

Code:
/*

  • To change this license header, choose License Headers in Project Properties.
  • To change this template file, choose Tools | Templates
  • and open the template in the editor.
    */
    package letterdiamond;

/**
*

  • @author NiiRosh
    */
    public class Letterdiamond {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      // TODO code application logic here
      char[] a = {'A', 'B', 'C', 'D'};

      for (int i = 0; i < a.length; i++) {
      for (int j = 0; j < a.length; j++) {
      if (j < i) {
      System.out.print(" ");
      } else {
      System.out.print(a[j]);
      }
      }
      for (int j = a.length - 2; j >= i; j--) {
      System.out.print(a[j]);
      }
      System.out.println("");
      }
      }

}

Output:
pattern20

from java.

leoprabin10 avatar leoprabin10 commented on July 30, 2024

public static void main(String[] args) {
char[] a = {'A', 'B', 'C', 'D'};
for (int i = 0; i < 5 - 1; i++) {
for (int j = 0; j < 5 - 1; j++) {
if (j < i) {
System.out.print(" ");
} else {
System.out.print(a[j] + " ");
}
}
for (int j = 5 - 3; j >= i; j--) {
System.out.print(a[j] + " ");
}
System.out.println();
}
image

from java.

Rajjushrestha avatar Rajjushrestha commented on July 30, 2024

char[] a = {'A', 'B', 'C', 'D'};
for (inti = 0; i<a.length; i++) {
for (int j = 0; j <a.length; j++) {
if (j >= i) {
System.out.print(a[j]);
} else {
System.out.print(" ");
}
}
for (int j = a.length - 2; j >= 0; j--) {
if (j >= i) {
System.out.print(a[j]);
} else {
System.out.print(" ");
}

        }

System.out.println("");
21

from java.

rivab avatar rivab commented on July 30, 2024

System.out.println("Output of Q.No.21");
char[] b = {'A', 'B', 'C', 'D'};
for (int i = 0; i < b.length; i++) {
for (int j = 0; j < i; j++) {
System.out.print(" ");
}
for (int k = 0; k < b.length - i; k++) {
System.out.print(b[k + i]);
}
for (int l = 1; l < b.length - i; l++) {
System.out.print(b[b.length - 1 - l]);
}
System.out.println(" ");
}

21

from java.

Sudan15423 avatar Sudan15423 commented on July 30, 2024

/*

  • To change this license header, choose License Headers in Project Properties.
  • To change this template file, choose Tools | Templates
  • and open the template in the editor.
    */
    package day4;

/**
*

  • @author dragon15423
    */
    public class Day4 {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      for (int i = 0; i <= b.length - 1; i++) {
      for (int j = 1; j <= i; j++) {
      System.out.print(" ");
      }
      for (int j = i; j <= b.length - 1; j++) {
      System.out.print(b[j]);
      }
      for (int j = b.length - 2; j >= i; j--) {
      System.out.print(b[j]);
      }
      System.out.println();
      }
      }
      Output:
      20

from java.

ajay987 avatar ajay987 commented on July 30, 2024

patt20sol
patt20sol

    char[] b = {'A', 'B', 'C', 'D', 'C', 'B', 'A'};
    for (int i = 0; i < b.length; i++) {
        if (i == 0) {
            for (int j = 0; j < b.length; j++) {
                System.out.print(b[j]);
            }
        } else {
            for (int l = 0; l < i; l++) {
                System.out.print(" ");

            }

            for (int k = i; k < b.length - i; k++) {
                System.out.print(b[k]);

            }
        }

        System.out.println();
    }

from java.

bsnarnzt1 avatar bsnarnzt1 commented on July 30, 2024

package patterntwenty;

/**
*

  • @author User
    */
    public class PatternTwenty {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      char[] a = {'A', 'B', 'C', 'D'};
      for (int i = 0; i < a.length; i++) {
      for (int j = 0; j < a.length; j++) {
      if (j < i) {
      System.out.print(" ");
      }
      else {
      System.out.print(a[j]);
      }
      }
      for (int k = a.length - 2; k >= i; k--) {
      System.out.print(a[k]);
      }
      System.out.println(" ");
      }
      }
      }
      patt20

from java.

rituratnam avatar rituratnam commented on July 30, 2024

CODE:
package pattern20;

/**
*

  • @author Lavalesh
    */
    public class Pattern20 {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      char[] b = {'A', 'B', 'C', 'D'};
      for (int i = 0; i < b.length; i++) {
      for (int j = 0; j < i; j++) {
      System.out.print(" ");
      }
      for (int k = 0; k < b.length - i; k++) {
      System.out.print(b[k + i]);
      }
      for (int l = 1; l < b.length - i; l++) {
      System.out.print(b[b.length - 1 - l]);
      }
      System.out.println(" ");
      }
      }
      }
      Output:
      pattern20

from java.

duwalshraddha avatar duwalshraddha commented on July 30, 2024

Code
package pattern18;

/**
*

  • @author Lenovo
    */
    public class Pattern18 {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      // TODO code application logic here
      char[] a = {'A', 'B', 'C', 'D'};
      for (int i = 0; i < a.length; i++) {
      for (int j = 0; j < i; j++) {
      System.out.print(" ");
      }
      for (int j = i; j < a.length; j++) {
      System.out.print(a[j]);
      }
      for (int j = 2; j >= i; j--) {
      System.out.print(a[j]);
      }
      System.out.println("");
      }
      }

}
188

from java.

SusanCB avatar SusanCB commented on July 30, 2024

/*

  • To change this license header, choose License Headers in Project Properties.
  • To change this template file, choose Tools | Templates
  • and open the template in the editor.
    */
    package pat18;

/**
*

  • @author nissus
    */
    public class Pat18 {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {

      char[] ch = {'A', 'B', 'C', 'D'};
      for (int i = 0; i < ch.length; i++) {
      for (int j = 1; j <= i; j++) {
      System.out.print(" ");
      }
      for (int j = i; j < ch.length; j++) {
      System.out.print(ch[j]);

       }
       for (int k = ch.length - 2; k >= i; k--) {
           System.out.print(ch[k]);
       }
       System.out.println(" ");
      

      }
      }
      // TODO code application logic here
      }

pat18

from java.

sarumdr avatar sarumdr commented on July 30, 2024

public class Pattern20 {

/**

@param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
char[] a = {'A', 'B', 'C', 'D', 'E'};
int i, j;
int N = 5
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
if (j < i) {
System.out.print("\t");
} else {
System.out.print(a[j] + "\t");
}
}
for (j = N - 2; j >= i; j--) {
System.out.print(a[j] + "\t");
}
System.out.println("");
}

}
}

OUTPUT
image

from java.

sanzeevtamang avatar sanzeevtamang commented on July 30, 2024

//pattern 20
char[] b = {'A', 'B', 'C', 'D'};
for (int i = 0; i < b.length; i++) {
for (int j = 0; j < b.length; j++) {
if (j >= i) {
System.out.print(b[j]);
} else {
System.out.print(" ");
}
}

        for (int j = b.length - 2; j >= 0; j--) {
            if (j >= i) {
                System.out.print(b[j]);
            } else {
                System.out.print(" ");
            }
        }

image

from java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.