Advertisement
18126

ExampleTestNo1Ex2

Mar 22nd, 2022
805
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. #define print printf("%d\n", num)
  6.  
  7. int main(int args, char *argv[]) {
  8.     int num;
  9.     while(scanf("%d", &num) != EOF) {
  10.         if(args == 1) {
  11.             print;
  12.         } else if(strcmp(argv[1], "-evens") == 0 && num%2 == 0) {
  13.             print;
  14.         } else if(strcmp(argv[1], "-odds") == 0 && num%2 != 0) {
  15.             print;
  16.         } else if(strcmp(argv[1], "-positives") == 0 && num >= 0) {
  17.             print;
  18.         } else if(strcmp(argv[1], "-negatives") == 0 && num < 0) {
  19.             print;
  20.         }
  21.     }
  22.     return 0;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement