using System;
using System.Collections.Generic;
using System.Text;
namespace PascalTriangle
{
class PascalTriangle
{
static void Main(string[] args)
{
System.Console.WriteLine("Pascal Triangle Program");
System.Console.Write("Enter the number of rows: ");
string input = System.Console.ReadLine();
int n = Convert.ToInt32(input);
for(int i=0; i<n; i++)
{
int c=1;
for(int j=0; j<=i; j++)
{
System.Console.Write(c);
c=c*(i-j)/(j+1);
System.Console.Write(" ");
}
System.Console.Write("\n");
}
System.Console.WriteLine();
System.Console.WriteLine();
}
}
}
using System.Collections.Generic;
using System.Text;
namespace PascalTriangle
{
class PascalTriangle
{
static void Main(string[] args)
{
System.Console.WriteLine("Pascal Triangle Program");
System.Console.Write("Enter the number of rows: ");
string input = System.Console.ReadLine();
int n = Convert.ToInt32(input);
for(int i=0; i<n; i++)
{
int c=1;
for(int j=0; j<=i; j++)
{
System.Console.Write(c);
c=c*(i-j)/(j+1);
System.Console.Write(" ");
}
System.Console.Write("\n");
}
System.Console.WriteLine();
System.Console.WriteLine();
}
}
}
http://www.kidsfront.com/ hurry up visit he site and grab the study material
ReplyDelete