Programming Examples
Python program to print Floyds triangle
Write a program to print Floyd's triangle as shown below:
1
2Â 3
4Â 5Â 6
7Â 8Â 9Â 10
11 12 13 14 15
Solution
x=1
for a in range(1,6):
for b in range(1,a+1):
print(x,end=' ')
x=x+1
print()
Output
1Â Â
2Â 3Â Â
4Â 5Â 6Â Â
7Â 8Â 9Â 10Â Â
11Â 12Â 13Â 14Â 15Â Â