Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include <stdio.h>
  2. int main() {
  3.     int num, sumPosi = 0, sumNega = 0, posi = 0, nega = 0;
  4.     while(scanf("%d", &num) && num < 100 && num > -100) {
  5.         if(num > 0) {
  6.             sumPosi = sumPosi + num;
  7.             posi++;
  8.         }
  9.         else if(num < 0) {
  10.             sumNega = sumNega + num;
  11.             nega++;
  12.         }
  13.     }
  14.     printf("%d %d %d %d", nega, posi, sumNega, sumPosi);
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement