Subscribe to Feeds

Send Your Projects To georgepj@hotmail.com

We'll Publish It With Your Name :-)

Programs Can Also Be Downloaded From The Folders Below....[Or Scroll Down]

Cout +ve & -ve Nos

Click Here To Download C File Of This Program

 //Count +ve nd -ve Nos  
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
void main()
{
int l,pos=0,neg=0,a,n=0,p=0;
clrscr();
printf("\nEnter Limit :");
scanf("%d",&l);
while(l>0)
{
scanf("%d",&a);
if(a>0)
{ p++;
pos=pos+a; }
if(a<0)
{
n++;
neg=neg+a;
}
l--;
}
printf("\n\tThe Total +ve Nos. : %d",p);
printf("\n\tThe Sum of +ve Nos. : %d",pos);
printf("\n\tThe Total -ve Nos. : %d",n);
printf("\n\tSum of -ve Nos. : %d",neg);
getch();
}

0 comments:

Post a Comment