Created
April 15, 2018 03:00
-
-
Save SangRyul/668618a5d01d4e4b6a08c12da373d9cd to your computer and use it in GitHub Desktop.
2018새싹교실 1반 -3차시
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//program 1 | |
//#pragma warning(disable:4996) | |
//#include<stdio.h> | |
// | |
// | |
//int sum(int n); | |
// | |
//int main(void) { | |
// | |
// int n; | |
// printf("INPUT Numer =>"); | |
// scanf("%d", &n); | |
// printf("sum of 1 - %d : %d", n, sum(n)); | |
// | |
// system("pause"); | |
// return 0; | |
//} | |
// | |
//int sum(int n) { | |
// if (n == 1) { | |
// return 1; | |
// } | |
// else { | |
// return n + sum(n - 1); | |
// } | |
//} | |
//program2 | |
//#pragma warning(disable:4996) | |
//#include <stdio.h> | |
// | |
//int func2(int x) | |
//{ | |
// if (x == 0) | |
// return; | |
// func2(x - 1); // 재귀호출 | |
// | |
// puts("\n func2함수"); | |
// printf(" func함수 x = %3d addr ==> %d \n", x, &x); | |
// | |
//} | |
// | |
//int main() | |
//{ | |
// | |
// puts(" 번지수를 잘 보세요 "); | |
// | |
// func2(3); | |
// system("pause"); | |
// return 0; | |
//} | |
//program3 | |
//#include<stdio.h> | |
// | |
//int arr1[4] = { 1,2,3,4 }; | |
//int arr2[] = { 5,6,7,8 }; | |
//int arr3[4] = { 0, }; | |
// | |
//int main(void) { | |
// | |
// for (int i = 0; i < 4; i++) { | |
// printf("%d ", arr1[i]); | |
// } | |
// printf("\n"); | |
// for (int i = 0; i < 4; i++) { | |
// printf("%d ", arr2[i]); | |
// } | |
// printf("\n"); | |
// for (int i = 0; i < 4; i++) { | |
// printf("%d ", arr3[i]); | |
// } | |
// printf("\n"); | |
// | |
// for (int i = 0; i < sizeof(arr1) / sizeof(int); i++) { | |
// printf("%d ", arr1[i]); | |
// } | |
// printf("\n"); | |
// | |
// for (int i = 0; i < sizeof(arr1) / sizeof(int); i++) { | |
// printf("%x ", &arr1[i]); | |
// } | |
// | |
// system("pause"); | |
// return 0; | |
// | |
//} | |
//배열 사이즈 상수 값으로 고정시키고 싶을 때 #define VAL 20 이런걸로 고정하는 것도 하나의 방법 | |
//program 5 | |
//#pragma warning(disable:4996) | |
//#include<stdio.h> | |
// | |
//int arr[5]; | |
// | |
//int main(void) { | |
// | |
// | |
// for (int i = 0; i < 5; i++) { | |
// scanf("%d", &arr[i]); | |
// | |
// } | |
// for (int i = 0; i < 5; i++) { | |
// printf("%d \n", arr[i]); | |
// } | |
// | |
// system("pause"); | |
// return 0; | |
//} | |
//program6 | |
//#pragma warning(disable:4996) | |
//#include<stdio.h> | |
// | |
//int arr[4][4]; | |
//int arr2[2][2] = { | |
// {1,2}, | |
// {3,4} | |
//}; | |
// | |
//int main(void) { | |
// for (int i = 0; i < 4; i++) { | |
// for (int j = 0; j < 4; j++) { | |
// arr[i][j] = i + j; | |
// } | |
// } | |
// | |
// for (int i = 0; i < 4; i++) { | |
// for (int j = 0; j < 4; j++) { | |
// printf("arr[%d][%d] = %d ", i, j, arr[i][j]); | |
// } | |
// printf("\n"); | |
// } | |
// system("pause"); | |
// return 0; | |
//} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment