Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

new to C and programming please help

Name: Anonymous 2011-11-20 3:18

I am doing this example from the book C all-in-one desk reference for dummies, the proper answer is suppose to be 34.64
but my answer is always 0.00 .
my os is linux mint 9, here is the code:

#include <stdio.h>
#include <math.h>

#define RAD 57.2957795

int main()
{
    double opposite,angle;
    float degrees,adjacent;

    puts("how tall is that tree?");
    printf("how far away is the tree in feet?");
    scanf("&f",&adjacent);
    __fpurge(stdin);
    printf("what angle is it to the tree top?");
    scanf("&f",&degrees);

  /*convert degrees to rads */

    angle = (double)degrees/RAD;

  /* get the tree height */

     opposite = tan(angle) * (double)adjacent;

     printf("that tree is %.2f feet tall.\n",opposite);
     return(0);
}

Name: Anonymous 2011-11-20 10:20

>>3
When something doesn't work as expected, it's always your fault. Always.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List