Floyd Triangle using Alphabet

Floyd Triangle using Alphabet in java
abcd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package logic;
 
import java.util.Scanner;
 
public class Pattern13 
{
 
	public static void main(String[] args) 
	{
 
		Scanner c =new Scanner(System.in);
 
		System.out.println("enter a number");
		int n=c.nextInt();
 
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<=i;j++)
			{
				System.out.printf("%c",'A'+j);
 
			}
			System.out.println();
		}
	}
 
}
 
 
output:
 
enter a number
5
 
A
AB
ABC
ABCD
ABCDE

Triangle Pattern in java

Triangle Pattern in java

triangle

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package logic;
 
public class pattrnprog 
{
 
	public static void main(String[] args)
 
	{
 
		for(int i=0;i<=4;i++)
		{
			for(int j=i;j<=4;j++)
			{
				System.out.print(" ");
 
			}
 
			for(int k=0;k<(2*i)+1;k++)
			{
				System.out.print("*");
			}
 
			System.out.println();
 
 
		}
	}
}