完全に乗り遅れてるけど気にしないでやってみる。
using System;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
int m = 1;
int n = 10;
Console.WriteLine("{0} to {1} the total is {2}", m, n, AddNumber(1, 10));
Console.ReadKey();
}
static int AddNumber(int x, int y) {
return (x < y ? x + AddNumber(x + 1, y) : y);
}
}
}
何か無駄が多いと思うけど今の自分の力じゃこんなもん。