If you're having problems, it's often handy to include your own debug lines:
This way you can be sure your numbers are correct.
#include <math.h> /* contains sin function */
#define PI 3.14 /* used in conversion of degrees to radians */
#define SCALE 35
int counter, index, lines;
double degree, radians, scale_sine;
printf("Type in the initial step size in degrees:\n");
*** I will assume an err on your part here and assume you
*** have this line correct in your actual code, right? If not,
*** here is your problem.
printf("Type in the number of lines to be printed:\n");
radians = degree * PI/180; /* convert degrees to radians */
scale_sine = SCALE * sin(radians);
*** Debug lines.
printf("DEBUG: %f radians. %f scale_sine. %f degree.\n",
radians, scale_sine, degree );
*** See how simple that is, and how benificial it can be?
for(counter = 0; counter < lines; ++counter)
*** Debug Lines.
printf("DEBUG: %d counter < %d lines\n",
counter, lines );
for(index = -SCALE; index < scale_sine; ++index)
You could even make a macro to do it for you.