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 | #include <stdio.h> #include <string.h> #pragma warning (disable:4996) int main() { char string[100]; char letter; int size; scanf("%s", string); scanf(" %c", &letter); size = strlen(string); for (int i = 0; i < size; i++) { if (letter == string[i]) { printf("%d", i); return 0; } } printf("No"); return 0; } | cs |
프로그래밍 문제/정올