Created
November 13, 2014 10:57
-
-
Save JubbaSmail/a907f0c83e5631c46a3f to your computer and use it in GitHub Desktop.
This file contains hidden or 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(int argc, char *argv[]) | |
| { | |
| if (argc != 4) { | |
| printf("Usage: exe num1 opr num2\n"); | |
| return 1; | |
| } | |
| int x = strtol(argv[1]); | |
| int y = strtol(argv[3]); | |
| int z = 0; | |
| if (strcmp(argv[2],"+") == 0 ) | |
| z = x + y; | |
| else if (strcmp(argv[2], "-") == 0) | |
| z = x - y; | |
| else if (strcmp(argv[2], "*") == 0) | |
| z = x * y; | |
| else if (strcmp(argv[2], "/") == 0) | |
| z = x / y; | |
| printf("%d\n", z); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment