Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 03 / Tasks and Solutions / 07. ContainsDigit.cpp
blob: 4ae11314be35bd4b4bb5512b0124a305266a16a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
using namespace std;

int main()
{
	int n, searchedDigit;
	cin >> n >> searchedDigit;

	bool found = false;
	while (n != 0)
	{
		int lastDigit = n % 10;
		if (searchedDigit == lastDigit)
		{
			found = true;
			break;
		}
		n /= 10;
	}
}