using System;
namespace Faktorial_0320100024
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
int n,fak,k;
Console.Write("Masukkan Angka: ");
n=Convert.ToInt32(Console.ReadLine());
if(n==0)
{
Console.WriteLine("Hasil Faktorialnya adalah 1");
Console.ReadLine();
}
else
{
fak=1;
for(k=1;k<=n;k++)
{
fak=fak*k;
}
Console.WriteLine("Hasil Faktorialnya adalah {0}",fak);
Console.ReadLine();
}
}
}
}
0 comments:
Post a Comment