Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #define print printf("%d\n", num)
- int main(int args, char *argv[]) {
- int num;
- while(scanf("%d", &num) != EOF) {
- if(args == 1) {
- print;
- } else if(strcmp(argv[1], "-evens") == 0 && num%2 == 0) {
- print;
- } else if(strcmp(argv[1], "-odds") == 0 && num%2 != 0) {
- print;
- } else if(strcmp(argv[1], "-positives") == 0 && num >= 0) {
- print;
- } else if(strcmp(argv[1], "-negatives") == 0 && num < 0) {
- print;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement