#include<stdio.h>
main()
{
int no,pcount,ncount,zcount;
char ch;
ncount=0;
pcount=zcount=ncount;
do
{
printf("enter a no ");
scanf("%d",&no);
if(no>0)
pcount++;
else if(no<0)
ncount++; else
zcount++;
printf("Do you want to enter more numbers(y/n):");
getchar();
ch=getchar();
}
while(ch=='y');
printf("\n positive numbers negative numbers zeros");
printf("\n ---------------------------------------------");
printf("\n %8d %15d %17d",pcount,ncount,zcount);
}
OUTPUT
enter a no 46
Do you want to enter more numbers(y/n):y
enter a no 89
Do you want to enter more numbers(y/n):nPositive numbers negative numbers zeros
---------------------------------------------
2 0 0
main()
{
int no,pcount,ncount,zcount;
char ch;
ncount=0;
pcount=zcount=ncount;
do
{
printf("enter a no ");
scanf("%d",&no);
if(no>0)
pcount++;
else if(no<0)
ncount++; else
zcount++;
printf("Do you want to enter more numbers(y/n):");
getchar();
ch=getchar();
}
while(ch=='y');
printf("\n positive numbers negative numbers zeros");
printf("\n ---------------------------------------------");
printf("\n %8d %15d %17d",pcount,ncount,zcount);
}
OUTPUT
enter a no 46
Do you want to enter more numbers(y/n):y
enter a no 89
Do you want to enter more numbers(y/n):nPositive numbers negative numbers zeros
---------------------------------------------
2 0 0