Checking Number Of Positive and Negative and Zero's Available

C Program For Checking Number Of Positive and Negative and Zero's Available Source Code: #include<stdio.h> #include<conio.h> void main() { int i,n,num,c=0,d=0,e=0; printf("enter num of element:"); scanf("%d",&n); for(i=1;i<=n;i++) { printf("enter a num:"); scanf("%d",&num); if(num<0) { c=c+1; } if(num==0) { d=d+1; } if(num>0) { e=e+1; } } printf("num of pos=%d,num of zero=%d,num of neg=%d",c,d,e); } OUTPUT: enter num of element:5 enter a num:0 enter a num:-3 enter a num:6 enter a num:7 enter a num:-8 num of pos=2,num of zero=1,num of neg=2

Share:

0 comments