Created
March 18, 2016 07:54
-
-
Save byronmejia/4627d478b7329b984a28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
double x = 0; | |
double y = 0; | |
double z = 0; | |
char c = ' '; | |
WHILE: | |
printf("Enter First Number: "); | |
scanf("%lf", &x); | |
printf("Enter Second Number: "); | |
scanf("%lf", &y); | |
CHAR: | |
printf("Enter calc [*,/,+,-]: "); | |
scanf("%c", &c); | |
switch(c){ | |
case '*': | |
z = x * y; | |
goto ANS; | |
case '/': | |
z = x / y; | |
goto ANS; | |
case '+': | |
z = x + y; | |
goto ANS; | |
case '-': | |
z = x - y; | |
goto ANS; | |
} | |
goto CHAR; | |
ANS: printf("Answer: %lf\n", z); | |
ANOTHER: printf("Another? [y/n]"); | |
scanf("%c", &c); | |
switch(c){ | |
case 'y': | |
case 'Y': | |
goto WHILE; | |
case 'n': | |
case 'N': | |
goto EXIT; | |
} | |
goto ANOTHER; | |
EXIT: printf("GoodBye"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment