0% found this document useful (0 votes)
11 views

Pattern

Uploaded by

hanukumar2007
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Pattern

Uploaded by

hanukumar2007
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

class Pattern

{
void pat()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
System.out.print(j);
}
System.out.println();
}
}
void pat(int n)
{
int i,j;
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
System.out.print("*");
}
System.out.println();
}
}
void pat(char p)
{
int i,j,c=1;
for(i=1;i<=8;i++)
{
for(j=1;j<=c;j++)
{
System.out.print(p);
}
c+=2;
System.out.println();
}
}
public static void main(String args[])
{
Pattern obj = new Pattern();
obj.pat();
obj.pat(5);
obj.pat('#');
}
}

You might also like