Untitled

mail@pastecode.io avatar
unknown
c_cpp
a year ago
807 B
2
Indexable
Never
#include <iostream>
#include <string>
using namespace std;

int main()
{
	int a;int b;
	cin >> a;
	cin >> b;
	int i = 0;int a1 = a;
	int j = 0;int b1 = b;
	int f = 1;
	int g;
	int result;
	while (a1 / 10 > 0) {
		a1 = a % 10;
		i += 1;
	}
	while (b1 / 10 > 0) {
		b1 = b % 10;
		j += 1;
	}
	if(a!=b){
		if (a>b) {
			while (i-j>=f) {
				int mn = 10;
				g = a % f * mn;
				mn = mn * 10;
				f += 1;
			}
		}
		else if (a < b) {
			while (j - i >= f) {
				int mn = 10;
				g = b % f * mn;
				mn = mn * 10;
				f += 1;
			}
		}
	std::string str = std::to_string(b);
	std::string str1 = std::to_string(g);
	result = b + g;
	}
	else {
		std::string str = std::to_string(b);
		std::string str1 = std::to_string(a);
		result = b + a;
	}
	
	cout << result;
}