I've been writing a code for a simple scientific calculator. Now, I've used math.h library but it gives the values of sin,cos,tan in radians while i want in degrees. I've tried using *180/PI but it isn't working. on the other hand, it's working (*180/PI) with the inverse values.
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Sin = "<<sin(a)*180.0/PI <<endl;
break;
case 8:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Cos = "<<cos(a)*180.0/PI <<endl;
break;
case 9:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Tan = "<<tan(a)*180.0/PI <<endl;
I expect the output in degrees but it doesn't show that correctly. Meanwhile, here's the code for inverse in which it's working correctly.
case 10:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Inverse of Sin = "<<asin(a)*180.0/PI<<endl;
break;
case 11:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Inverse of Cos = "<<acos(a)*180.0/PI<<endl;
break;
case 12:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Inverse of tan = "<<atan(a)*180.0/PI<<endl;
break;