0% found this document useful (0 votes)
32 views3 pages

Ques28-Write A Program To Display The Pattern

The document contains 3 Java programs that print out different patterns. The first program prints a pyramid of asterisks with decreasing space. The second prints a pyramid of letters 'a' with increasing number of letters on each line. The third prints a pattern of increasing then decreasing numbers, with the highest number in the middle.

Uploaded by

MishraAviral
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views3 pages

Ques28-Write A Program To Display The Pattern

The document contains 3 Java programs that print out different patterns. The first program prints a pyramid of asterisks with decreasing space. The second prints a pyramid of letters 'a' with increasing number of letters on each line. The third prints a pattern of increasing then decreasing numbers, with the highest number in the middle.

Uploaded by

MishraAviral
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Ques28- Write a program to display the pattern:*

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

Ques29- Write a program to print pattern:a


a
a
a
a

a
a
a
a

a
a
a

a
a

public class patern2


{
public static void main(String args[])
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
System.out.print("a ");
System.out.println();
}
}
}

Ques30- Write a program to display the following pattern:1

1
public class pattern3
{
public static void main(String args[])
{
int i,j;
for(i=7;i>=1;i=i-2)
{
for(j=1;j<=i;j++)
System.out.print(j+" ");
System.out.println();
}
}
}

You might also like