YEEI

mail@pastecode.io avatar
unknown
c_cpp
2 months ago
577 B
1
Indexable
Never
#include <iostream>
#include <string>
using namespace std;

int main()
{
	int a, b, c, d, one, two, three, four;
	cin >> a;
	if (a >= 1000 and a <= 9999)
	{
		while (a)
		{
			b =a % 10; // 1234 = 4
			four = b; // 4
			a /= 10; // 1234 = 123
			b =a % 10; // 123 = 3
			three = b;
			a /= 10;
			b =a % 10;
			two = b;
			a /= 10;
			b =a % 10;
			one = b;
			a /= 10;
			c = one - four;
			d = two + three;
			if (d == c)
			{
				cout << "Yes";
			}
			else
			{
				cout << "No";
			}
		}
	}
	else
	{
		cout << "ne v diapazone";
	}
}