Pages

Write a Function to Check Number is +ve or -ve

Friday, 19 April 2013



#include <stdio.h>
#include <conio.h>
char _positive(int num)
{
     if(num<0)
     {
              printf("Number is -ve.");    
     }
     else if(num>0)
     {
              printf("Number is +ve.");      
     }
     else
 
     {
              printf("Number is -ve nor +ve.");      
     }
}
main()
{
      int num;
  printf("Enter a number: ");
  scanf("%d", &num);
  printf("%c", _positive(num));
  getch();
}

 

Search Box

Most Reading

Contact Form

Name

Email *

Message *