Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. ///
  2. //  main.c
  3. //  ht02_01
  4. //
  5. //  Created by Артем Барышев on 19.09.2018.
  6. //  Copyright © 2018 Артем Барышев. All rights reserved.
  7. //
  8.  
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11.  
  12. int
  13. main(int argc, char *argv[])
  14. {
  15.     long long sum_minus = 0;
  16.     long long sum_plus = 0;
  17.     for (int i = 1; i < argc; ++i) {
  18.         long long now = atoi(argv[i]);
  19.         if (now < 0) {
  20.             sum_minus += now;
  21.         }
  22.         else {
  23.             sum_plus += now;
  24.         }
  25.     }
  26.     printf("%lld\n%lld\n", sum_plus, sum_minus);
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement