So you have two doubles, d1 and d2, that are initialized to the values of PI and E, respectively. Your program needs to swap the values so that d1 is E and d2 is PI. Simple enough right?
Oh, almost forgot, there's a bit of a catch. These are the only two variables that you can declare in your program. Yep, d1 and d2. That's it. Feel free to use any language. I'd love to see solutions in languages other than C++ and Java, especially C#, Python, Perl, VB and PHP.
BTW, a 'harder' solution does not use a pointer or reference of any kind either. A 'simple' solution does - I'll let others quible over whether a pointer or refernce should be considered a variable. If you don't get the hard solution, go ahead and post the simple one. I'll post both in a couple of days.
Backstory: Our local ACM chapter is preparing for the ACM Regional contest and one of my teammates thought he could stump me this morning with this problem. He is Chineese w/ an accent and crazy laugh.... "Larry, I can do this in C++, but you could never do this in Java. <smiles>Cause it is impossible to do it in Java!<crazy loud laugh - 2 minutes, 110 db, I'm not kidding>." I sat down for a minute and the simple solution took me about 3 minutes to which he carried on about the use of a reference. I had to take care of some business today, and while I was at the bank of all places, the answer occured to me and I implemented the 'hard' solution in 2 working lines of code (1 for declarations and one for the swapping). I taped the solution on the 'Problem of the Day' whiteboard. I can't wait to see his face in the morning.
Good luck and, if stumped, try going to the bank.