Here's the problem:
Write a C program to generate a table of conversion from degrees to radians. Your table should include a third column that contains the sine of the angle. Print 10 lines int he table with starting angle at 0 degree and allow the user to enter the ending angle in degrees.
Here's my code so far:
But my problem is mainly on what to do to just print 10 lines Here's my attempt.Code:#include <stdio.h> #include <math.h> #define PI 3.1416 int main(void) { double radians,sinx; int degrees; int end; printf(" Enter the ending angle in degrees"); scanf("%d",&end); for(degrees=0;degrees<=end;degrees=degrees+10) { radians=degrees*PI/180; sinx= sin(radians); printf("%d %.3f %.3f\n",degrees,radians,sinx); } getch(); }
I tried using this:
I don't know what to do to print 10 lines in the loop proportional to the ending degree value. I know I messed up incrementing it by 10 in here which would mess up the loop, but I don't know what else to do. Please any help would be appreciated.Code:for(degrees=0,k=1;degrees<=end,k<=10;degrees=degrees+10,k++)



LinkBack URL
About LinkBacks



