Display sum of all positive & negative numbers

Write a C program to accept 'n' different numbers and display sum of all positive & negative numbers.

Solution:

#include<stdio.h>
int main()
{
      int n, ps = 0, ns = 0, num,i;
      printf("How Many Numbers you Want to Enter: ");
      scanf("%d",&n);
      printf("\nEnter %d Numbers:\n\n",n);
      //for(;n>0; n--)
      for(i=1;i<=n;i++)
      {
            scanf("%d",&num);
            if(num > 0)
                  ps=ps+num;
            else
                  ns=ns+num;
      }
      printf("Sum of Positive Numbers = %d\nSum of Negative Numbers = %d",ps,ns);
      return 0;
}


Output:

sum positive negative