using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study02 { class Program { //매서드 정의시엔 영문으로 동사를 먼저(기능), 대문자로 시작함 static void AttackWolf() { Console.WriteLine("늑대를 공격합니다."); } //Main 매서드 static void Main(string[] args) { SayHello(); } //1.어떤 기능을 할지 머리속에 정한다. //2.그 기능의 의미를 가지고 매서드를 정의한다 //3.class 내부에 void 매서드명(){} //4.머릿속에..
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study02 { class Program { static void Main(string[] args) { for (int i = 0; i < 5; i++) { for (int h = 0; h < 5 - (i + 1); h++) { Console.Write(" "); } for (int j = 0; j
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study02 { class Program { static void Main(string[] args) { for (int i = 0; i < 8; i++) { for (int j = 0; j < i + 1; j++) { Console.Write("*"); } Console.WriteLine(); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study02 { class Program { static void Main(string[] args) { int fsum; int ssum; for (int i = 0; i 1) { Console.WriteLine(); for (int j = 0; j < 9; j++) { fsum = i + 1; ssum = j + 1; Console.WriteLine("{0} X {1} = {2}", fsum, ssum, fsu..
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study02 { class Program { enum FruitType { Apple, banana } static void Main(string[] args) { Console.WriteLine("더할 숫자를 정해주세요."); int input2 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("{0} 선택하셨습니다.", input2); int sum = 0; for (int i = 0; i < input2; i++) { su..
string number; int num; number = Console.ReadLine(); int numbermain = Convert.ToInt32(number); Console.WriteLine("{0}단 선택하셨습니다.", number); int result; for (int i = 0; i < 9; i++) { num = i + 1; result = numbermain * num; Console.WriteLine("{0} x {1} = {2}", numbermain, num, result); } 연산자 * 는 곱하기
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study02 { class Program { enum ItemType { SWORD, DAGGER } static void Main(string[] args) { //형식 변환 //문자열(숫자형) -> 정수 string strNum = "12"; int num = Convert.ToInt32(strNum); //정수 -> 문자열 int num2 = 300; string strNum2 = num2.ToString(); //정수 -> 실수 int num3 = 123; float fNu..