Aug 24, 2007

Display Hello World without semicolon

C# version

namespace WriteHelloWorld
{
class Program
{
static void Main(string[] args)
{

while (!"0".Equals(System.Console.Title = "Hello world").Equals(System.Console.ReadLine()))
{
}

}
}
}


C++ version
#include "stdio.h"

int main()
{
while( !printf( "Hello World\n" ) )
{
}
}

1 comments:

Anonymous said...

class Program
{
static void Main(string[] args)
{
while (args == typeof(System.Console).InvokeMember("WriteLine",
(System.Reflection.BindingFlags)280, null, null,
new object[] { "Hello, world!" }))
{ }
}
}

will do the trick too