Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void calculator_division(int ss, string number1, string number2)
- {
- cleaning();
- Translation tr = new Translation();
- if (Convert.ToInt32(number1) >= Convert.ToInt32(number2))
- {
- tr.translation(ss, number1);
- string a_ = tr.Reply;
- tr.cleaning();
- tr.translation(ss, number2);
- string b_ = tr.Reply;
- tr.cleaning();
- string _b = null;
- string c = null;
- string ot = null;
- string obr = null;
- string l = null;
- int k = 0;
- if (a_.Length > b_.Length)
- {
- int kol = a_.Length - b_.Length;
- while(kol != 0)
- {
- b_ = b_ + '0';
- k++;
- kol--;
- }
- }
- int sm = k;
- for (int i = 0; i < b_.Length; i++)
- {
- if (b_[i] == 49)
- {
- _b = _b + "0";
- }
- else
- {
- _b = _b + "1";
- }
- }
- calculator_sum(2, _b, "1");
- _b = reply;
- if (a_.Length > _b.Length)
- {
- int kol = a_.Length - _b.Length;
- while (kol != 0)
- {
- _b = '0' + _b ;
- kol--;
- }
- }
- calculator_sum(2, a_, _b);
- c = reply;
- if (c.Length > a_.Length)
- {
- ot = ot + "1";
- c = c.Remove(0, 1);
- }
- else
- {
- ot = ot + "0";
- }
- while (k != 0)
- {
- if(ot[ot.Length - 1] == '0')
- {
- c = c.Remove(0, 1);
- c = c.Insert(c.Length - 1, "0");
- calculator_sum(2, c, b_);
- }
- else
- {
- c = c.Insert(c.Length - 1, "0");
- calculator_sum(2, c, _b);
- }
- c = reply;
- if (c.Length > a_.Length)
- {
- ot = ot + "1";
- c = c.Remove(0, 1);
- }
- else
- {
- ot = ot + "0";
- }
- k--;
- }
- cleaning();
- int g = 0;
- while (ot[g] == '0')
- {
- g++;
- }
- for (int i = g; i < ot.Length; i++)
- {
- reply = reply + Convert.ToString(ot[i]);
- }
- int _0 = 0;
- for (int i = 0; i < c.Length; i++)
- {
- if (c[i] == '0')
- {
- _0++;
- }
- }
- if (_0 != c.Length)
- {
- while (sm != 0)
- {
- int r = c.Length;
- c = c.Remove(r - 1);
- sm--;
- }
- g = 0;
- while (c[g] == '0')
- {
- g++;
- }
- string pr = null;
- pr = reply;
- for (int i = g; i < c.Length; i++)
- {
- obr = obr + c[g];
- }
- if (pr[pr.Length - 1] == '1')
- {
- //string l = null;
- for (int i = 0; i < obr.Length; i++)
- {
- if (obr[i] == 49)
- {
- l = l + "0";
- }
- else
- {
- l = l + "1";
- }
- }
- calculator_sum(2, l, "1");
- obr = reply;
- }
- cleaning();
- reply = pr + "," + obr;
- }
- Console.WriteLine("{0} ", reply);
- }
- else
- {
- reply = "0";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement