목록분류 전체보기 (72)
이것저것
http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&sca=1080 JUNGOL www.jungol.co.kr 자가진단1 #include int main(void) { int n, count = 0, result = 0; scanf("%d", &n); for (int i = 1; i = n) { printf("%d %d", count, result); break; } result += i; count++; } return 0; } 자가진단2 #include int main(void) { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { for (int j = 0; j 0; i--) { for (int j = i; j..
if using UnityEngine; public class IfExample : MonoBehaviour { // 제어문(Control statement) // - 조건문(if, switch), 반복문(for, while, foreach) // if, else, else if /* if(조건식){ 조건식이 참일 때 실행할 코드 }else if(조건식2){ 조건식1은 거짓이고, 조건식 2는 참일 때 실행할 코드 }else{ 조건식1과 조건식2가 거짓일 때 실행할 코드 } */ void Start(){ float number = 5.5f; if(number == 4.0f){ Debug.Log("값이 4입니다"); }else if(number == 3.0f){ Debug.Log("값이 4는 아니지만 3입니..
using UnityEngine; public class OperatorExample : MonoBehaviour { // 1. 산술 연산자 // +,-,*,/,%,++,-- // 2. 대입연산자 // =, 산술연사자와 결합하여 사용 // 3. 논리연산자 // &&(AND), ||(OR), !(NOT) // 4. 비교연산자 // >, 결과 값이 boolean(true/false) void Start(){ int a = 10; int b = 2; // 산술 Debug.Log(a+b); // 12 Debug.Log(a -b); // 8 Debug.Log(a*b); // 20 Debug.Log(a/b); // 5 Debug.Log(a % b); // 0 Debug.Log(10 % 3); // 1 a++; b-..
http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&sca=1070 JUNGOL www.jungol.co.kr 자가진단1 #include int main(void) { char c; scanf("%c", &c); for (int i = 0; i < 20; i++) printf("%c", c); return 0; } 자가진단2 #include int main(void) { for (int i = 10; i < 21; i++)printf("%d ", i); return 0; } 자가진단3 #include int main(void) { int n; scanf("%d", &n); for (int i = 1; i 0) printf("JUNGOL\n"); } 형성평가2 #..
http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&sca=1060 JUNGOL www.jungol.co.kr 자가진단1 #include int main(void) { int i = 1; while (i = 100) { result /= count; printf("%0.1f", result); break; } } return 0; } 자기진단5 #include int main(void) { int n; while (1) { scanf("%d", &n); if (n == -1) break; if (n % 3 == 0) { printf("%d\n", n / 3); } } return 0; } 자가진단6 #include int main(void) { int n; wh..
http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=165&sca=1050 JUNGOL www.jungol.co.kr 자가진단1 #include int main(void) { int n; printf("정수 입력: "); scanf("%d", &n); if (n 0) printf("Obesity"); return 0; } 자가진단3 #include int main(void) { int ..
operator 모듈 함수 1. itemgetter() Name_tuples = [ ('olivia', 21,90), ('chris', 24,85), ('jane', 20,88) ] from operator import itemgetter print(sorted(Name_tuples, key = itemgetter(1))) # age 오름차순 정렬 >>> [('jane', 20, 88), ('olivia', 21, 90), ('chris', 24, 85)] 2. attrgetter() class Name: def __init__(self, name, age, score): self.name = name self.age = age self.score = score def printInfo(self): re..
class FourCal: def setdata(self, first, second): self.first = first self.second = second def add(self): result = self.first + self.second return result def mul(self): result = self.first * self.second return result def sub(self): result = self.first - self.second return result def div(self): result = self.first / self.second return result a = FourCal() a.setdata(4,2) print(a.add()) print(a.mul()..