C Programming Code Examples C > Conversions Code Examples Convert string to double: How to use atof: sines calculator Convert string to double: How to use atof: sines calculator #include <stdio.h> #include <stdlib.h> #include <math.h> int main () { double i, j; double pi=3.1415926535; char str[256]; printf ( "Enter degrees: " ); gets ( str ); i = atof ( str ); j = sin ( i * pi / 180 ); printf ( " sine of %f degrees = %f \n" , i, j ); return 0; }