In this article i would like to explore about an Floyad's Traingle Program
Overview:
Floyd's triangle is a right angled-triangle using the natural numbers.
Examples of Floyd's Traingle are:
Ex1:
1
2 3
4 5 6
7 8 9 10
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ft
{
class Program
{
static void Main(string[] args)
{
int i, j, r, k = 1;
Console.WriteLine("Enter the range: ");
r = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("FLOYD'S TRIANGLE");
for (i = 1; i <= r; i++)
{
for (j = 1; j <= i; j++, k++)
Console.Write(k+"\t");
Console.WriteLine("\n");
}
Console.ReadLine();
}
}
}
OutPut:
Overview:
Floyd's triangle is a right angled-triangle using the natural numbers.
Examples of Floyd's Traingle are:
Ex1:
1
2 3
4 5 6
7 8 9 10
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ft
{
class Program
{
static void Main(string[] args)
{
int i, j, r, k = 1;
Console.WriteLine("Enter the range: ");
r = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("FLOYD'S TRIANGLE");
for (i = 1; i <= r; i++)
{
for (j = 1; j <= i; j++, k++)
Console.Write(k+"\t");
Console.WriteLine("\n");
}
Console.ReadLine();
}
}
}
OutPut:
No comments:
Post a Comment