This is a Cpp program which prints the Floyd's triangle with respect to the input given.
Download Code
Floyds triangle |
PROGRAM :
#include <iostream> using namespace std; int main() { int i, j, k = 1,n; cout << "Enter the range: "; cin >> n; cout << "\nFLOYD'S TRIANGLE : \n"; for (i = 1; i <= n; i++) { for (j = 1; j <= i; j++, k++) { cout << "\t" << k; } cout << "\n" ; } return 0; }
OUTPUT :
Cpp Program - Floyds Triangle |