Im using c#
using System;
using System.Threading;
using System.Runtime.InteropServices;
namespace codechef
{
class Program
{
[DllImport("User32.Dll", EntryPoint = "PostMessageA")]
private static extern bool PostMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
const int VK_RETURN = 0x0D;
const int WM_KEYDOWN = 0x100;
private decimal round(decimal i4, decimal i2, decimal i3)
{
return (Math.Round(i4,MidpointRounding.AwayFromZero) + Math.Round(i2,MidpointRounding.AwayFromZero) + Math.Round(i3, MidpointRounding.AwayFromZero));
}
static void Main(string[] args)
{
for(int ie=1;ie<=10;ie++)
{
string str = null;
ThreadPool.QueueUserWorkItem((s) =>
{
Thread.Sleep(500);
if(string.IsNullOrEmpty(str))
{
var hWnd = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
PostMessage(hWnd, WM_KEYDOWN, VK_RETURN, 0);
}
});
str = Console.ReadLine();
if (string.IsNullOrEmpty(str))
{
break;
}
else
{
decimal i = decimal.Parse(str);
decimal i2 = i / 2;
decimal i3 = i / 3;
decimal i4 = i / 4;
if (new Program().round(i2,i3,i4) > i)
{
Console.WriteLine(new Program().round(i2, i3, i4));
}
else
{
Console.WriteLine(i);
}
}
}
}
}
}
What is wrong with this