using System.Collections.Generic;
using System.Threading.Tasks;
namespace FactPowerOfNumber
public int factorial(int n)
return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
public static int power(int x,int y){
return (y == 0) ? 1 : x * power(x, y - 1);
public static void Main(string[] args)
Console.WriteLine(".....Factorial Number.....");
Console.WriteLine("___________________________");
Console.WriteLine("Enter Number:");
int num = Convert.ToInt32(Console.ReadLine());
Program obj = new Program();
Console.WriteLine("Factorial of " + num + " is " + obj.factorial(num));
Console.WriteLine("-----------------------------");
Console.WriteLine("......Power of Number......");
Console.WriteLine("___________________________");
Console.WriteLine(" Input the base value : ");
int bNum = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(" Input the exponent : ");
int pwr = Convert.ToInt32(Console.ReadLine());
int result = power(bNum, pwr);
Console.WriteLine(" The value of {0} to the power of {1} is : {2} \n\n", bNum, pwr, result);