Currently I am doing the first exercises from Illustrating C. The exercise that I am trying first is the one where someone can input degrees and the program will be able to put those in to sin or cos. Im trying to use fgets to take input from the user. the answer can only be sin or cos. Im having trouble with how to get it to work.

My goal is to have the output of the choice sin or cos. Store that choice. proceed to ask what the degrees are from the user. then i would have the degree input multiplied by pi/180 converting it to radians and having the program compute it that way

Any help is greatly appreciated.

this is what i have so far

Code:#include <stdio.h> #include <math.h> #include <string.h> int a; int main() { char text; int x = 3.14159265358979323846264338327; printf ("\n Would you like to compute a sin or cos function? \n"); fgets( text, 3, stdin); printf("\n %s \n",text ); return 0; }