Good morning,
How to change the following code
Code:
#include<stdio.h>
int main()
{
int a[100], n, i, psum=0, nsum=0;
printf("Size od the table [1-100]: ");
scanf("%d",&n);
printf("Write %d elements: ",n);
for(i=0; i<n; i++)
{
scanf("%d",&a[i]);
if(a[i]<0) nsum += a[i];
else psum += a[i];
}
printf("Sum of positive numbers: %d",psum);
printf("\nSum of negative sumbers: %d",nsum);
return 0;
}
so I don't need to write the size of the board and I can just write and write elements until I write 0, so then it fnishes?
And how I can print all positive elements and all negative elements??