1. 내가 쓴 정답 : 시간 초과로 문제가 생겼다. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace N { class Program { static void Main(string[] args) { string snum = Console.ReadLine(); int num = Convert.ToInt32(snum); for (int i = 1; i
1. &&, != && : 조건이 두개다 일치 할 때 != : 조건이 일치하지 않을 때 2. 정답 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; //윤년이면 1 아니면 0 // 윤년 : 4의 배수이면서 100의 배수가 아닌것 or 400의 배수 namespace yoonnyun { class Program { static void Main(string[] args) { // 문자열로 연도를 입력 받는다, string syear = Console.ReadLine(); // 받은 문자열을 숫자로 바꾼다 int year = Convert.ToInt32..
1. 문자열 입력 string sInput = Console.ReadLine(); 2. 문자열 -> 정수 변환(오늘 날짜 문제에서 나온 정수로 형변환) int input1 = Convert.ToInt32(sInput1); int input2 = Convert.ToInt32(sInput2); 3. 절댓값 int absnum = Math.Abs(input1 - input2); 4. 정답일거라고 생각했지만 정답이 아닌 코드..(런타임에러(Format)가 뜬다.. 내일 물어봐야지! ) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace sa..
1. 형변환 a. 암시적 형변환 : 주로 작은 범위의 자료형에서 큰 범위의 자료형으로 변환할 때 일어난다. ex) int -> long (O) long -> int (X) int a = 1; long b = a; b. 명시적 형변환 : 괄호 안에 바꾸고자 하는 자료형을 넣어 명시적으로 형 변환을 한다 long a = 1; int b = (int) a; 2. 문자열 변환 (int-> string, string-> int) a. Convert 사용 int month = 1 string newMonth; if (month int) 3. 정답 using System; using Sys..