using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
- namespace PartialTest
{
partial class Arithmetic
{
public int Factorial(int num)
{
int factorial = 1;
for (int i = num; i > 0; i--)
{
factorial *= i;
}
return factorial;
}
}
partial class Arithmetic
{
public int Square(int num)
{
return num * num;
}
}
class Program
{
static void Main(string[] args)
{
Arithmetic a = new Arithmetic();
int num = 5;
Console.WriteLine("求 {0} 的阶乘:",num);
Console.WriteLine(a.Factorial(num));
Console.WriteLine("求 {0} 的平方:", num);
Console.WriteLine(a.Square(num));
Console.ReadKey();
}
}
}