prev


for loop

108.counting no.of Positive , Negative or Zero (31.05.2010)

/*
Program# 108
date : 10-01-2009
counting no.of Positive , Negative or Zero
*/

#include <stdio.h>
main(){
int n;
int p,ne,z;

p=ne=z=0;

for(scanf("%d",&n);n!=-1000;scanf("%d",&n)){
if(n>0)
p++;
else
if(n<0)
ne++;
else
if(n==0)
z++;
}
printf("\n %d %d %d",p,ne,z);
}



next
blog comments powered by Disqus