## What is Floyd's triangle?

Floyd triangle is a right angled triangle consisting of consecutive natural numbers starting with one and then going down through the rows.

For Example:

Defined 5 rows Floyd triangle.

1

2 3

4 5 6

7 8 9 10

11 12 13 14 15

## Algorithm of Floyd Triangle

1. Create variables that holds row and column values as i and j. Take a number to display the rows as number and set the variable k to 1 its initial value.
2. Use Nested Loop
• Outer for loop starts its iteration i = 1 up to rows
• Inner for loop starts its iteration from j = 1 up (j<=i)
3. Print the value of k
4. Increment the value of k by 1
5. And jump to the new line after each iteration of the inner loop.
6. Exit.

## Floyd Triangle print in c program

``````#include <stdio.h>
int main()
{
int row;
printf("Enter the rows : ");
scanf("%d", &row);
int k=1;
for(int i=1; i<=row; i++){
for(int j=1; j<=i; j++){
printf("%d ", k);
k++;
}
printf("\n");
}
return 0;
}
``````

## C++ program to print Floyd's Triangle

``````#include <iostream>
using namespace std;
int main()
{
int row;
cout<<"Enter the rows : ";
cin>>row;
int k=1;
for(int i=1; i<=row; i++){
for(int j=1; j<=i; j++){
cout<<k<<" ";
k++;
}
cout<<endl;
}
return 0;
}
``````

## Print Floyd's Triangle using while loop in c

``````#include <stdio.h>
int main()
{
int row;
printf("Enter the rows : ");
scanf("%d", &row);
int k=1, i = 1, j=1;
while(i<=row){
j = 1;
while(j<=i){
printf("%d ", k);
k++;
j++;
}
i++;
printf("\n");
}
return 0;
}
``````

## Print Floyd's triangle using while loop in c++

``````#include <iostream>
using namespace std;

int main()
{
int row;
cout<<"Enter the rows : ";
cin>>row;
int k=1, i = 1, j=1;

while(i<=row){
j = 1;
while(j<=i){
cout<<k<<" ";
k++;
j++;
}
i++;
cout<<endl;
}

return 0;
}
``````

Output:

1
2 3
4 5 6
7 8 9 10
11 12 13 14 15

## Program to print the Floyd's triangle without natural number in c

``````#include <stdio.h>
int main()
{
int row;
printf("Enter the rows : ");
scanf("%d", &row);
for(int i=1; i<=row; i++){
for(int j=1; j<=i; j++){
printf("* ");
}
printf("\n");
}
return 0;
}
``````

## Print Floyd's Triangle without natural number in c++ programming language

``````#include <iostream>
using namespace std;

int main()
{
int row;
cout<<"Enter the rows : ";
cin>>row;
for(int i=1; i<=row; i++){
for(int j=1; j<=i; j++){
cout<<"* ";
}
cout<<endl;
}
return 0;
}
``````

Output:

*
* *
* * *
* * * *
* * * * *

## Write a program to reverse a number

Write a program to reverse a number. What is reverse number?

## Sum of digit calculate program

We can get the sum of the digit by adding every digits of the given number forgetting the place of value of the digit.

## Program to Calculate the power of given numbers by user in c and cpp

In this program, we will take two inputs from the users, one will be the base and the another one is exponent.

## Write a program to count the digit in a Number

To count the digits of a given number, divided that number by 10 until that number is greater than 0.

## Insertion and Deletion of all operation at Singly Linked List in C Programming Language

Insertion and Deletion in Singly(singular) linked list in C programming langauge Data Structure. How to Implement insertion and deletion.

## Simple Macro Substitution(#define) in C and C++ programming language

Program to Explain Simple Macro Substitution ( #define ) c and c++ programming language