Thursday, 2 January 2014

Detect '-' , '=' , '0'

A program that detect - , = , 0



#include<stdio.h>
void main()
{
int num,counter=0,a=0,b=0,c=0,x=9;

while(counter<5
{
scanf("%d",&num);
if(num>0)
{a++;}
else if(num<0)
{
b++;
}
else if(num==0)
{c++;}
else
{x--;}
counter++;
}
printf("\nnumber of positive num = %d",a + c);
printf("\nnumber of zeros = %d",c);
printf("\nnumber of negitive num = %d",b);
}

No comments:

Post a Comment