Saturday, March 12, 2011
1
C Program Language (Converting Radian to Degree)
Another program will be shown be tackling on how to convert degree to radian using the math.h functions with the help of fabs, floor and ceil. The sample output.
Check out the codes and have fun.
#include<stdio.h> #include<conio.h> #include<stdlib.h> #include<math.h> float degrees(float a) { return floor((a*180)/3.141592654); } float minutes(float a) { return floor((((a*180)/3.141592654)-floor((a*180)/3.141592654))*60); } float seconds(float a) { return ((((a*180)/3.141592654)-floor((a*180)/3.141592654))
*60-floor((((a*180)/3.141592654)-floor((a*180)/3.141592654))*60))*60; }
main() { float a; char s; printf("Enter a radian: "); scanf("%f", &a); printf("\n\nThe equivalent is:"); printf("\n\nDegrees: %.0f", degrees(a)); printf("\nMinutes: %.0f", minutes(a)); printf("\nSeconds: %.0f", seconds(a)); printf("\n\nPress y to continue and x to exit: "); scanf("%s", &s); if(s=='y') { system("cls"); return main(); getch(); } if(s=='x') { return 0; }}
Subscribe to:
Post Comments (Atom)
1 Responses to “C Program Language (Converting Radian to Degree)”
September 14, 2016 at 1:23 AM
All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.
SAP training in Chennai
SAP ABAP training in Chennai
SAP FICO training in Chennai
SAP MM training in Chennai
SAP SD training in Chennai
SAP HR training in Cheennai
Post a Comment