Skip to content

Commit

Permalink
#26 메서드 기본
Browse files Browse the repository at this point in the history
  • Loading branch information
guddus326 committed Jun 29, 2021
1 parent 222967c commit 41121df
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion CSBasic5/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,31 @@ namespace CSBasic5
{
class Program
{
class MethodExample
{
public int Power(int x)
{
return x * x;
}

public int Multi(int x, int y)
{
return x * y;
}

public void Print()
{
Console.WriteLine("Print() 메서드 호출됨");
}
}
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
MethodExample me = new MethodExample();
Console.WriteLine(me.Power(10));
Console.WriteLine(me.Power(20));
Console.WriteLine(me.Multi(52, 273));
Console.WriteLine(me.Multi(103, 32));
me.Print();
}
}
}

0 comments on commit 41121df

Please sign in to comment.