How to display Floyd's triangle in python program
FLOYD'S TRIANGLE
Floyd's triangle is a triangular array of natural numbers, used in computer science education. It is named after Robert Floyd. It is defined by filling the rows of the triangle with consecutive numbers, starting with a 1 in the top left corner.
ROBERT W. FLOYD
Born - June 8, 1936
Died - September 25, 2001 (aged 65)
Robert W Floyd was a computer scientist. His contributions include the design of the Floyd–Warshall algorithm (independently of Stephen Warshall), which efficiently finds all shortest paths in a graph, Floyd's cycle-finding algorithm for detecting cycles in a sequence, and his work on parsing. In one isolated paper he introduced the important concept of error diffusion for rendering images, also called Floyd–Steinberg dithering (though he distinguished dithering from diffusion). He pioneered in the field of program verification using logical assertions with the 1967 paper Assigning Meanings to Programs. This was a contribution to what later became Hoare logic. Floyd received the Turing Award in 1978.
PROGRAM CODING
num=int(input("Enter the number of rows"))
n=1
for i in range (1,num+1):
for j in range (i):
print(n,end='')
n=n+1
print( )
Comments
Post a Comment