http://cpbook.subeen.com/2012/11/positive-negative.html
soliution::
#include<stdio.h>
int main()
{
long long int n,b,a,sum=0,total=0;
scanf("%lld", &n);
for(b = 1; b<=n; b++)
{
scanf("%lld",&a);
if (a>=0)
{
total=total+1;
}
else if(a<0)
{
sum=sum+1;
}
}
printf("%lld %lld\n",total,sum);
return 0;
}
No comments:
Post a Comment