Programing Puzzles
Koroskin Denis
2korden at gmail.com
Wed Aug 6 18:17:31 PDT 2008
On Thu, 07 Aug 2008 01:50:56 +0400, Wyverex <wyverex.cypher at gmail.com>
wrote:
> just some fun little programming puzzles I found around online...
>
>
>
> Write a "Hello World" program in 'C' without using a semicolon.
> (Note: #include in C doesn't need a semicolon but import does)
>
>
>
> Problem #1 Write a "Hello World" program in D with only a semicolon on
> import statement.
>
> Problem #2 Test if an int is even or odd without looping or if statement
> (Cant use: do, while, for, foreach, if).
>
> Problem #3 Write a program without using any loop (if, for, while etc)
> to print numbers from 1 to 100 and 100 to 1;
>
> Problem #4 Find if the given number is a power of 2.
>
// 0 is considered a power of two here
bool isPowerOfTwo(int i) {
return (i & (i-1) == 0);
}
More information about the Digitalmars-d-learn
mailing list