

CPP Program To Print Floyd's Triangle using For Loop
source link: https://www.geeksforgeeks.org/videos/cpp-program-to-print-floyds-triangle-5-row-using-for-loop/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

- 330 Views
- 04/04/2022
What is Floyd's triangle? A Floyd’s triangle is a triangle with first natural numbers.
In this CPP program, we have printed Floyd's triangle using the for loop. Basically, 2 loops are used here and a number is initialized as 1 and then incremented on every iteration. The outer loop has the condition as the variable 'i' initialized to 0 and then iterate until i<n where n is the number of rows. The inner loop has a variable j initialized as 0 and iterates it until the condition j<=i. Then you have to print the variable number for each iteration like number++ and at the same time, it would e incremented.
Related article: https://www.geeksforgeeks.org/c-program-print-floyds-triangle/
Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.
Recommend
-
11
CPP Program to Check Whether a character is Vowel or ConsonantCPP Program to Check Whether a character is Vowel or ConsonantVideo Player is loading.Loaded: 0%Remaining Time -7...
-
13
Java Program to Print Star Pattern in Triangle ShapeJava Program to Print Star Pattern in Triangle ShapeHello everyone. My name is iron today. We are...
-
14
Java Program to Print Floyd's TriangleJava Program to Print Floyd's Triangle10 Views15/06/2022In this video, we will print Floyd's Triangl...
-
4
Create a FileCreate a File | CPP ProgramHello everyone. Welcome to Geeks to Geeks. In90 Views16/07/2022
-
14
CPP Program to Check if Two Strings are AnagramsCPP Program to Check if Two Strings are Anagrams40 Views18/07/2022In this video, w...
-
8
C Program to Print Alphabets from A to Z Using LoopSkip to content
-
7
Javascript program to find area of triangleSkip to content
-
7
C++ Program to find Area & perimeter of an Isosceles TriangleSkip to content
-
9
Python program to Print alphabets from A to Z using LoopSkip to content
-
12
C++ program to find the perimeter and area of triangleSkip to content C++ program to find t...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK