prev


While-Loop

55.Sum of postive or negative or zero nos - until -1000 is given. (02.02.2010)

/*
Program# 55
date : 28-12-2008
Sum of postive or negative or zero nos - until -1000 is given.
*/

#include <stdio.h>
main(){
int n=0,p=0,ne=0,z=0;
scanf("%d ",&n);
while(n!=-1000){
if(n>0)
p=p+n;
else
if(n<0)
ne=ne+n;
else
z=z+n;
scanf("%d ",&n);
}
printf("\n Positive : %d \n Negative : %d \n Zero : %d",p,ne,z);
}



next
blog comments powered by Disqus