Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Alphabet in zigzag pattern

Hi Friend,

Today we can see about how Alphabet can be display in zigzag patter using array method in java.

Here i made it in 5 row. It can be done simple decision making concept.

The first understanding of this pattern program is

The characters can be able to print in row by row manner.

So firt row of character should be print

A                    I                    Q                         Y

Then the second row

B         H        J         P       R            X                z


ABCDE – this is happen because of i==j

EFGHI – This is happen because of  i+j==8

Let us discuss in program:

public class zigzagAlphabet{

public static void main(String[] args) {

char ch[]={‘A’,’B’,’C’,’D’,’E’,’F’,’G’,’H’,’I’,’J’,’K’,’L’,’M’,’N’,’O’,’P’,’Q’,’R’,’S’,’T’,’U’,’V’,’W’,’X’,’Y’,’Z’};
for(int i=0;i {
for(int j=0;j {
if(i==j || i+j==8 || j-i==8 || i+j==16 || j-i==16 || i+j==24 || j-i==24)
System.out.print(” “);




A                  I                    Q                    Y
B           H   J               P   R              X   Z
C      G         K         O       S         W
D  F              L    N           T    V
E                   M                 U

The post Alphabet in zigzag pattern appeared first on Payilagam | Java | .NET | Selenium| PHP | Android | DevOps| Ionic| Best Training in Chennai.

This post first appeared on Best .NET Training Institutes In Chennai, please read the originial post: here

Share the post

Alphabet in zigzag pattern


Subscribe to Best .net Training Institutes In Chennai

Get updates delivered right to your inbox!

Thank you for your subscription