Silahkan di copas pada masing masing aplikasi Microsoft Visual Studionya :). Setelah itu tekan F5 untuk menjalankan programnya :D
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int h;
Console.Write("m!\nMasukkan Nilai N = ");
int n = int.Parse(Console.In.ReadLine());
h = 1;
Console.Write(n + "! =");
for (int i = 1; i <= n; i++)
{ h = h * i;
Console.Write(n-(i-1));
if (i != n)
Console.Write("*");
}
Console.WriteLine();
Console.Write(n+ "!");
Console.Write("=");
Console.WriteLine(h);
Console.ReadLine();
}
}
}
Sumber:http://espada-society.blogspot.co.id/2011/11/mencari-nilai-faktorial-pada-c.html
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int h;
Console.Write("m!\nMasukkan Nilai N = ");
int n = int.Parse(Console.In.ReadLine());
h = 1;
Console.Write(n + "! =");
for (int i = 1; i <= n; i++)
{ h = h * i;
Console.Write(n-(i-1));
if (i != n)
Console.Write("*");
}
Console.WriteLine();
Console.Write(n+ "!");
Console.Write("=");
Console.WriteLine(h);
Console.ReadLine();
}
}
}
Sumber:http://espada-society.blogspot.co.id/2011/11/mencari-nilai-faktorial-pada-c.html
0 Komentar:
Post a Comment