Мээрим
Мээрим

Нужна помощь в переводе кода с Pascal на С#

Код с паскаля нужно перевести в C#. Спасибо откликнувшимся!

Вот код:

var X,Y:extended;
N,XX,ans:longint;
begin
Read(X,Y,N);
ans:=0;
XX:=trunc(x*n);
if x<>10.0 then
begin
XX:=trunc((x+0.05)*n);
while XX/N>=x+0.049999999999 do dec(XX);
end;

while (((ans+XX)/(ans+n))>=y+0.0499999999999 ) do ans:=ans+1000;
if ans>=1000 then
begin
ans:=ans-1000;
while (((ans+XX)/(ans+n))>=y+0.0499999999999 ) do ans:=ans+1;
end;
write(ans);
end.

Алексей
Алексей

decimal x, y;
long n, XX, ans = 0;
string[] input = Console.ReadLine().Split(' ');
x = decimal.Parse(input[0]);
y = decimal.Parse(input[1]);
n = long.Parse(input[2]);
XX = (long)Math.Truncate(x*n);
if (x != 10)
{

XX = (long)Math.Truncate((x + 0.05m)*n);
while (XX/n >= x + 0.049999999999m)
XX--;
}

while (((ans+XX)/(ans+n))>=y+0.0499999999999m )
ans+=1000;
if (ans >= 1000)
{
ans -= 1000;
while (((ans + XX)/(ans + n)) >= y + 0.0499999999999m)
ans++;
Console.WriteLine(ans);
}

Похожие вопросы
Нужна помощь по Pascal ABC
Нужна помощь в Pascal
Нужна помощь по Pascal
Перевод из С++ на Pascal
Перевод кода из с++ в pascal/delphi
Нужна помощь с Pascal
Нужна помощь с кодом в turbo pascal`e...
Нужна помощь в turbo pascal.
Нужна помощь с Pascal ABC
Нужна помощь в Pascal ABC...