1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #define SIZE 10 int main(void) { int key, i; int list[SIZE] = { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }; printf("[ "); for (i = 0; i < SIZE; i++) { printf("%d ", list[i]); } printf("]\n"); printf("Ž»öÇÒ °ªÀ» ÀÔ·ÂÇϽÿÀ:"); scanf("%d", &key); for (i = 0; i < SIZE; i++) { if (list[i] == key) { printf("Ž»ö ¼º°ø À妽º= %d\n", i); break; } } return 0; } | cs |