I need to have the program calculate the area of a circle from the inputs, converting degrees to radians, and checking for correct inputs such as letters instead of numbers or negative lengths. Here is the code I have:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define PI 3.1415926
int main()
{
  double base;
  double angleD;
  double angleR;
  double area;
  int in;
  char buffer[128];

while (1)
  {
    printf("Would you like to continue?(Y/N)  ");
    if((in = getchar()) == 'Y' || (in = getchar()) == 'y')
      while (1)
      {
        printf("Enter Base Length and Angle in degrees(Less than 90):   ");
        gets(buffer);
        int x = sscanf(buffer, "%lf %lf", &base, &angleD);
        if(x == 2)
          {
            if(base > 0 && angleD > 0)
            {
              angleR = angleD * PI / 180;
              area = base * base * tan(angleR) / 2;
              printf("Area is %7.4f\n", area);
	      break;
            }
            else
            {
              printf("No Negative Numbers Please\n");
            }
          }
        else
          {	
            printf("Please enter numbers only.\n");
          }
      }
    else
      {
        printf("Thank you!\n");
        break;
      }
  }
}
The problem is I get this when I try to run it as well as not accepting the lower case 'y':

Would you like to continue?(Y/N) Y
Enter Base Length and Angle in degrees(Less than 90): Please enter numbers only.
Enter Base Length and Angle in degrees(Less than 90):

I know it's a mess but I'm out of ideas and so are the other people I know who have any C experience. If you need anything cleared up let me know