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

BornJune 8, 1936
DiedSeptember 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 graphFloyd'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( )


OUTPUT OF THE PROGRAM 



                                           THANK YOU😊

Comments

Popular posts from this blog

Program to find out whether a given number is prime number or not in python[using break statement]

How to display BMI(Body mass index )using python program