using System;
namespace MyFirstProgram
{
internal class Program
{
static void Main(string[] args) // main method
{
String name = "JoLab";
int age = 22;
singHappyBirthday_1(); // 그냥 아무것도 없는 함수
singHappyBirthday_2(name); // 매개변수가 있는 함수 1
singHappyBirthday_3(name, age); // 매개변수가 있는 함수 2
}
static void singHappyBirthday_1()
{
Console.WriteLine("Happy birthday to you!");
Console.WriteLine("Happy birthday to you!");
Console.WriteLine("Happy birthday dear YOU!");
Console.WriteLine("Happy birthday to you!");
Console.WriteLine();
}
static void singHappyBirthday_2(String name)
{
Console.WriteLine("Happy birthday to you!");
Console.WriteLine("Happy birthday to you!");
Console.WriteLine("Happy birthday dear " + name);
Console.WriteLine("Happy birthday to you!");
Console.WriteLine();
}
static void singHappyBirthday_3(String name, int age)
{
Console.WriteLine("Happy birthday to you!");
Console.WriteLine("Happy birthday to you!");
Console.WriteLine("Happy birthday dear " + name);
Console.WriteLine("You are " + age + " years old!");
Console.WriteLine("Happy birthday to you!");
Console.WriteLine();
}
}
}
728x90
'언어 > [C#]' 카테고리의 다른 글
[C#] 함수 오버로딩 method overloading (0) | 2023.03.12 |
---|---|
[C#] 리턴값(반환값) return key word (0) | 2023.03.12 |
[C#] foreach loop: foreach 반복문 (0) | 2023.03.12 |
[C#] 배열 Arrays (0) | 2023.03.12 |
[C#] 계산기: Calculator (0) | 2023.03.12 |