Solution
#include<stdio.h>
int main(){
int n,sum=0,count=0,i=1,b;
scanf("%d",&n);
while(i<=n)
{
scanf("%d",&b);
i++;
if(b>=0)
{
count++;
sum=sum+b;
}
}
printf("Positive Numbers=%d\nSum=%d",count,sum);
return 0;
}
No comments:
Post a Comment