Posted on
22 Sep 2014 01:08 PM IST
double a = 22; double b = 7; // double result = a / b;
double temp = 0; string c = ""; int a1 = 0; string objResult="";
while (temp > 0) { if (a1 == 0) { temp = a % b; a1 = (int)(a / b); objResult = a1.ToString() + "."; a1++; } else { c = temp.ToString() + "0"; temp = Convert.ToInt32(c) % 7; a1 = Convert.ToInt32(c) / 7; objResult = objResult + a1.ToString(); }
Note: It runs infinite time, please stop the process
|