https://www.youtube.com/watch?v=9iHHKlFF2Ro&list=PLO56HZSjrPTB4NxAsEP8HRk6YKBDLbp7m&index=38
using System;
using static System.Console;
namespace testProject
{
class Program
{
static void Sum()
{
WriteLine("함계 구하는 함수");
}
static void Main(string[] args)
{
Sum();
}
}
}
using System;
using static System.Console;
namespace testProject
{
class Program
{
static void Sum(int num1, int num2) => WriteLine($"{num1} + {num2} = {num1+num2}");
static void Main(string[] args)
{
Sum(1, 2);
}
}
}
using System;
using static System.Console;
namespace testProject
{
class Program
{
static int Sum(int num1, int num2)
{
return num1 + num2;
}
static void Main(string[] args)
{
int sum = Sum(1, 2);
WriteLine($"합계 : {sum}");
}
}
}
using System;
using static System.Console;
namespace testProject
{
class Program
{
static int Sum(int num1, int num2) => (num1 + num2);
static int Sum(int num1, int num2, int num3)
{
return num1 + num2 + num3;
}
static void Main(string[] args)
{
int sum = Sum(1, 2);
WriteLine($"합계 : {sum}");
sum = Sum(1, 2, 3);
WriteLine($"합계 : {sum}");
}
}
}
using System;
using static System.Console;
namespace testProject
{
class Program
{
static void CountDown(int count)
{
if (count == 0) WriteLine("END");
else
{
WriteLine(count);
CountDown(count - 1);
}
}
static void Main(string[] args)
{
CountDown(10);
}
}
}