#include <stdio.h>
#include <stdbool.h>
bool check_digit_exists(int n, int digit) {
while (n > 0) {
if (digit == n % 10) {
return true;
}
n = n / 10;
}
return false;
}
int main(void)
{
int num = 230138;
printf("%d\n", check_digit_exists(num, 8));
printf("%d\n", check_digit_exists(num, 5));
return 0;
}
/*
run:
1
0
*/