int x;
scanf("%d",&x);
x=(double)((x*3.14)/180);
printf("%.6lf",x);
When I run the above code and input x=60, I get -0.000000.
int x;
double a;
scanf("%d",&x);
a=(x*3.14)/180;
printf("%.6lf",a);
But when I run this above code, I get the correct answer.
I want to know where I am doing wrong. Is there problem in my type casting or use of double or any other thing? Any help will be appreciated. Thanks!
N.B. : I need to print output upto 6 digits after decimal.