
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
C program to Check Whether a Number is Positive or Negative or Zero?
A number which is greater than 0 is positive and less than 0 are negative. The concept of positive and negative is very important in number theory and programming also. Calculations rely on this concept only.
Input: 0 Output:0 is zero
Explanation
Using conditional statement check the number with 0 weather it is greater than 0 or smaller than 0.
Example
#include <iostream> using namespace std; int main() { int n=0; if(n>0) { printf("%d is positive",n); } else if(n<0) { printf("%d is negative",n); } else { printf("%d is zero",n); } return 0; }
- Related Articles
- C++ Program to Check Whether a Number is Positive or Negative
- Java Program to Check Whether a Number is Positive or Negative
- How to check if a number is positive, negative or zero using Python?
- How to check whether a number is Positive or Negative in Golang?
- Check if a number is positive, negative or zero using bit operators in C++
- Check whether product of integers from a to b is positive, negative or zero in Python
- C# Program to check if a number is Positive, Negative, Odd, Even, Zero
- Python Program to Check if a Number is Positive, Negative or 0
- Program to check if a number is Positive, Negative, Odd, Even, Zero?
- What is zero if it is not a negative or positive number?
- Java Menu Driven Program to Check Positive Negative or Odd Even Number
- C++ Program to Check Whether a Number is Prime or Not
- C++ Program to Check Whether a Number is Palindrome or Not
- C Program to Check Whether a Number is Prime or not?
- C++ Program to Check Whether Number is Even or Odd

Advertisements