#include <iostream>
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;
std::cout << check_digit_exists(num, 8) << "\n";
std::cout << check_digit_exists(num, 5);
}
/*
run:
1
0
*/