# Probability Puzzle

I found this picture on Reddit. What’s the right answer? What if instead of 60% choice C was 0%?

# Proving that 1/8 Is Larger Than 1/4

Yep, you’ve read that right. Here we go (log below means log10, so log with base 10): 3 > 2 3 log(1/2) > 2 log(1/2) log[(1/2)³] > log[(1/2)²] (1/2)³ > (1/2)² 1/8 > 1/4 Convinced? If not, what’s wrong with the proof above? Click to see solution In reality log10(1/2) is negative, so the second […]

# C Programming Puzzle #3

The code of the previous puzzle was the following: #include <stdio.h> void foobar(char *str1, char *str2){   while (*((str1++)+6) = *((str2++)+8)); } int main(){   char str1[] = "Hello World";   char str2[] = "Foo Bar Bar";   foobar(str1,str2);   printf("%s %sn",str1, str2);   return 0; } The answer is that it prints “Hello Bar Foo Bar Bar”. Function foobar will […]

# C Programming Puzzle #2

The code of the first puzzle was: #include <stdio.h> int main(){     if("Hello World" == "Hello World"){        printf("Yes ","No ");     }     printf(10+"Hello World"-4); return 0; } The answer is that it prints “Yes World”. First of all the statement inside the IF will be executed because we compare the same pointer, which returns 1 (although […]

# C Programming Puzzle #1

What does the following program print? (The answer might also be that is doesn’t print anything due to compilation or run-time error). #include <stdio.h> int main(){     if("Hello World" == "Hello World"){        printf("Yes ","No ");     }     printf(10+"Hello World"-4); return 0; } The answer to this puzzle along with puzzle #2 can be found here.