#include <stdio.h>
int main() {
int S[] = {0, 10, 7, 11, 5, 13, 8};
int n = 7; // 0이 없을때!
int a;
scanf("%d", &a);
int flag = 0;
for (int i = 0; i <= (n - 1); i++) {
if (a == S[i]) {
flag = 1;
printf("%d", i + 1);
break;
}
}
if (flag == 0) {
printf("0");
}
return 0;
// int i = 1;
// while(조건문){}
// 조건문 : True 나 False 로 판별되는 식
// i == 1 -> True / False
// i ==1 && i > 2 -> False
// i ==1 && i >2 || i < 3 => True / False
// and / or
// && ||
// and: 하나만 False 여도 False // i == 2 && i > 2
// or: 하나만 True 여도 True // i == 2 || i > 3
}
To embed this project on your website, copy the following code and paste it into your website's HTML: