I am trying to execute following code which is the 1988 entry of Obfuscated C Code Contest.
#define _ -F<00||--F-OO--;
int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO()
{
_-_-_-_
_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_
_-_-_-_
}
From entry description, this code is calculating pi by looking at its own area. I successfully compiled it without changing the code. But when I executed, it is giving me a value 0.25, what I am expecting is 3.14. Code description says it is in K&R C and it doesn't work correctly in ANSI C without some change. I think I have to do those modification to execute it properly. I don't have any previous experience with K&R C. So can someone help me to change above code to ANSI C or point to the problems if any. I am using Microsoft Visual Studio 2008 to execute this.
Kelvin to Fahrenheit conversion is defined as converting a temperature from Kelvin to Fahrenheit unit. There are three units of measuring temperature - Kelvin, Fahrenheit, and Celsius. Converting Kelvin to Fahrenheit (K to F) is done by using the formula °F = (K − 273.15) × 1.8 + 32 or °F = (K − 273.15) × 9/5 + 32.
1 kelvin is equal to 0.33 N.
According to the Celsius to Kelvin formula, by adding 273.15, the temperature in Celsius can be converted to the temperature in Kelvin.
The easiest formula for converting Kelvin to Fahrenheit is F = 1.8*(K-273) + 32. Both Kelvin and Fahrenheit are temperature scales. However, Kelvin is an absolute scale with its zero at absolute zero.
If you have GCC, compile with the '-traditional-cpp
' flag.
The difference is whether the '-_
' sequence is translated to '- -F<00
' or '--F<00
'.
The one space is crucial: it's the difference between double negation and pre-decrement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With