b3ta.com board
You are not logged in. Login or Signup
Home » Messageboard » XXX » Message 9004611 (Thread)

# teh codez
$ cat >1.c
#include <stdio.h>
#include <math.h>
#define PI 3.1415926
int main(void)
{
 double theta = (35.0 / 180) * PI;
 double X = 8 * tan(theta);
 int Xft = floor(X);
 double Xin = (X - Xft) * 12;
 printf('X = %f feet, or %d feet %f inches\n', X, Xft, Xin);
 return 0;
}
$ gcc 1.c
$ ./a.out
X = 5.601660 feet, or 5 feet 7.219922 inches
$
(, Mon 8 Dec 2008, 10:55, archived)