計算10!の双曲線コサインを返します.
966 ワード
計算10!の双曲線コサインを返します。
using System;using System.Collections.Generic;using System.Text;
namespace ExFactorial{class Factorial{public double factorial(int num){switch (num){case 1:return 1;default :return num * factorial(num - 1); }
}static void Main(string[]args){Console.WriteLine(「整数を入力:」);int num=Convert.ToInt 32(Console.ReadLine();Factorial f=new Factorial();Console.WriteLine(「{0}!の値は{1}」,num,f.factorial(num);}}}}
using System;using System.Collections.Generic;using System.Text;
namespace ExFactorial{class Factorial{public double factorial(int num){switch (num){case 1:return 1;default :return num * factorial(num - 1); }
}static void Main(string[]args){Console.WriteLine(「整数を入力:」);int num=Convert.ToInt 32(Console.ReadLine();Factorial f=new Factorial();Console.WriteLine(「{0}!の値は{1}」,num,f.factorial(num);}}}}
public static int fac(int num){
if(num==1)
return 1;
else
return num * fac(num-1);
}
public static int nofac(int num){
int n =1;
if(num==1)
return 1;
else
for(int i=num;i>0;i--){
n = n*num;
num--;
}
return n;
}