Infolinks - Earn Easy Money

Saturday, April 4, 2015

C program to find out pos, neg and zeros

#include <iostream>
#include <conio.h>
#include <stdio.h>
using namespace std;
int main (  )
{
int num , x , pos=0 , neg=0 , zeroz=0 ;
cout <<" Enter how many numbers you want to Check ";
scanf ( "%d",&x );
while ( x > 0 )
{
scanf("%d" , &num);
if ( num > 0 )
pos++ ;
if ( num < 0 )
neg++ ;
if ( num == 0 )
zeroz++ ;
x-- ;
}
printf ( "\n You entered \n%d positive numbers \n%d negative numbers \n%d zeroes",pos,neg,zeroz);
return 0 ;
}

No comments:

Post a Comment

Must drop your comments about post.