I.
1
12
123
1234
12345
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (j <= i)
{
System.out.print(i);
}
}
System.out.println();
}
}
}
III.
A
AB
ABC
ABCD
ABCDE
public class Pattern
{
public static void main(String[] args)
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (j <= i)
{
System.out.print("*");
}
}
System.out.println();
}
}
}
12
123
1234
12345
public class Pattern
{
public static void main(String[] args)
{
for (int i = 1; i <= 5; i++)
{
int n=1;
for (int j = 1; j <= 5; j++)
{
if (j >= (6 - i))
{
System.out.print(n);
n++;
} else
System.out.print(" ");
}
System.out.println();
}
}
}
AB
ABC
ABCD
ABCDE
**
***
****
*****
1
12
123
1234
12345
public class Pattern
{
public static void main(String[] args)
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (j <= i)
{
System.out.print(j);
}
}
System.out.println();
}
}
}
II.
1
22
333
4444
55555
public static void main(String[] args)1
22
333
4444
55555
public class Pattern
{
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (j <= i)
{
System.out.print(i);
}
}
System.out.println();
}
}
}
III.
A
AB
ABC
ABCD
ABCDE
public class Pattern
{
public static void main(String[] args)
{
char c;
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (j <= i)
{
System.out.print(c);
c++;
}
}
System.out.println();
}
}
}
{
public static void main(String[] args)
{
char c;
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (j <= i)
{
System.out.print(c);
c++;
}
}
System.out.println();
}
}
}
IV.
A
BB
CCC
DDDD
EEEEE
public class Pattern
{
public static void main(String[] args)
{
char c = 'A';
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (j <= i)
System.out.print(c);
}
c++;
System.out.println();
}
}
}
{
public static void main(String[] args)
{
char c = 'A';
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (j <= i)
System.out.print(c);
}
c++;
System.out.println();
}
}
}
V.
*
**
***
****
*****
{
public static void main(String[] args)
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (j <= i)
{
System.out.print("*");
}
}
System.out.println();
}
}
}
VI.
1
22
333
4444
55555
1
22
333
4444
55555
public class Pattern
{
public static void main(String[] args)
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (j >= (6 - i))
System.out.print(i);
else
System.out.print(" ");
}
System.out.println();
}
}
}
VII.
112
123
1234
12345
public class Pattern
{
public static void main(String[] args)
{
for (int i = 1; i <= 5; i++)
{
int n=1;
for (int j = 1; j <= 5; j++)
{
if (j >= (6 - i))
{
System.out.print(n);
n++;
} else
System.out.print(" ");
}
System.out.println();
}
}
}
VIII.
AAB
ABC
ABCD
ABCDE
public class Pattern
{
public static void main(String[] args)
{
char c;
for (int i = 1; i <= 5; i++)
{
c = 'A';
for (int j = 1; j <= 5; j++)
{
if (j >= (6 - i))
{
System.out.print(c);
c++;
} else
System.out.print(" ");
}
System.out.println();
}
}
}
IX.
***
***
****
*****
public class Pattern
{
public static void main(String[] args)
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (j >= (6 - i))
System.out.print("*");
else
System.out.print(" ");
}
System.out.println();
}
}
}
****
***
**
*
X.
*********
***
**
*
public class Pattern
{
public static void main(String[] args)
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (j >= i)
System.out.print("*");
else
System.out.print(" ");
}
System.out.print("*");
else
System.out.print(" ");
}
System.out.println();
}
}
}
****
***
**
*
XI.
*********
***
**
*
public class Pattern
{
public static void main(String[] args)
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (j <= 6 - i)
System.out.print("*");
}
System.out.print("*");
}
System.out.println();
}
}
}