Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Apple Xcode
- // Conversão de um número em radianos e vice-versa
- #include <stdio.h>
- #define PI 3.1416
- int main (int argc, const char * argv[])
- {
- int the_option;
- float the_value = 0.00;
- float the_result = 0.00;
- printf("insira o valor: ");
- scanf("%f", &the_value);
- printf("\n");
- printf("1: graus->rad\n");
- printf("2: rad -> graus\n");
- scanf("%i", &the_option);
- switch(the_option) {
- case 1:
- the_result = the_value * PI / 180;
- printf("radianos: %f\n", the_result);
- break;
- case 2:
- the_result = the_value * 180 / PI;
- printf("graus: %f\n", the_result);
- break;
- default:
- printf("opcao invalida!\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement