YEEI

 avatar
unknown
c_cpp
a year ago
577 B
3
Indexable
#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";
	}
}
Editor is loading...