🌐
Programiz
programiz.com › c-programming › examples › negative-positive-zero
C Program to Check Whether a Number is Positive or Negative
#include <stdio.h> int main() { double num; printf("Enter a number: "); scanf("%lf", &num); if (num <= 0.0) { if (num == 0.0) printf("You entered 0."); else printf("You entered a negative number."); } else printf("You entered a positive number."); return 0; } You can also solve this problem ...
🌐
w3resource
w3resource.com › c-programming-exercises › conditional-statement › c-conditional-statement-exercises-3.php
C Program: Check whether a number is positive or negative - w3resource
#include <stdio.h> // Include the ... in 'num'. if (num >= 0) // Check if 'num' is greater than or equal to 0. printf("%d is a positive number \n", num); // Print a message indicating that 'num' is a positive number. else printf("%d ...
🌐
GeeksforGeeks
geeksforgeeks.org › c language › c-program-to-check-whether-a-number-is-positive-or-negative-or-zero
C Program to Check Whether a Number is Positive or Negative or Zero - GeeksforGeeks
First use if statement for zero, then else if statement of less than zero numbers (negative) and finally if nothing matches, then it is positive numbers. ... // C Program to check if a number is positive, negative, // or zero using simple ...
Published   July 11, 2025
🌐
PREP INSTA
prepinsta.com › home › c program › c program to check if a number is positive or negative
C Program to check if a Number Is Positive Or Negative
November 11, 2025 - ... #include &ltstdio.h&gt int ... negative/positive or zero if (num > 0) printf("The number is positive"); else if (num < 0) printf("The number is negative"); else printf("Zero"); return 0; } ... If the num > 0: it is a positive ...
🌐
Sanfoundry
sanfoundry.com › c-program-integer-positive-or-negative
Positive or Negative Number in C - Sanfoundry
May 13, 2022 - Here is source code of the C program which checks a given integer is positive or negative. The C program is successfully compiled and run on a Linux system. The program output is also shown below. ... 1. Take the integer which you want to check as input and store it in a variable number. 2. Using if,else statements check whether the integer is greater or lesser than zero.
🌐
BeginnersBook
beginnersbook.com › 2015 › 02 › c-program-to-check-whether-the-given-integer-is-positive-or-negative
C Program to check whether a given integer is positive or negative
In the following program, we are using if-else statement. If the input number is greater than zero then its a positive number else it is a negative number. If the number is zero then it is neither positive nor negative. #include <stdio.h> void main() { int num; // Prompt user to enter an integer ...
🌐
Codeforwin
codeforwin.org › home › c program to check whether a number is positive, negative or zero
C program to check whether a number is positive, negative or zero - Codeforwin
July 20, 2025 - Check if(num < 0), then number is negative. Check if(num > 0), then number is positive. Check if(num == 0), then number is zero. Let us code solution of the program.
🌐
Quora
quora.com › How-can-I-write-a-C-program-to-check-if-a-number-is-positive-or-negative-or-0
How to write a C program to check if a number is positive or negative or 0 - Quora
Answer (1 of 7): Hey..:—) So basically a number is 1. Positive — if the number is greater than zero 2. Negative — if the number is less than zero 3. Zero — if number is zero The code goes like this #include void main( ) { int n; printf(“Enter a number”); scanf(“%d”,&n); if(n==0)...
🌐
Tutorial Gateway
tutorialgateway.org › c-program-to-find-positive-or-negative-number
C program to find Positive or Negative Number
April 4, 2025 - Enter any number: 223 223 is Positive Enter any number: -3 -3 is Negative Enter any number: 0 You have entered Value zero. This program lets the user enter any number and then checks whether the entered value is either positive or negative or zero using the Else If Statement...
Find elsewhere
🌐
Medium
vigneswaran2510.medium.com › c-program-to-check-whether-a-number-is-positive-or-negative-41ece1d3851f
C program to check whether a number is positive or negative | by VIGNESWARAN.S | Medium
June 6, 2021 - Nested If in C is helpful if you want to check the condition inside a condtion. if the entered number is 0.0,it will print the statement “you entered 0” · In these lines else statement is used.Because if we entered less than 0.0 else statement will print the statement as “you entered a negative number” · Then the second else statement is ,if we didn’t entered 0.0 or less than 0.0 it will print the statement as “you entered a positive number”. return 0 in the main function means that the program executed successfully.
🌐
Saralcode
saralcode.com › c-programs › c-program-to-check-whether-a-number-is-positive-or-negative
C Program to Check Whether a Number is Positive or Negative
In this program, we have to take an integer as input from the user using scanf() function and store it in a variable. Then compare the number with 0. ... #include <stdio.h> void main(){ int num; printf("Enter a num: "); scanf("%d", &num); if (num > 0){ printf("Number is positive"); } else if (num < 0){ printf("Number is negative"); } else{ printf("Number is Zero"); } }...
🌐
Blogger
cprogramsbasics.blogspot.com › 2014 › 12 › c-program-positive-negative-number.html
C Programs Basics: C Program To Check If A Given Number is Positive Or Negative
#include<stdio.h> int main() { int n; printf("\n Enter Any Number : "); scanf("%d",&n); if(n>=0) { if(n==0) { printf("\n Number is Zero "); } else { printf("\n %d is Positive ",n); } } else { printf("\n %d is Negative ",n); } getch(); return 0; } ...
🌐
Techcrashcourse
techcrashcourse.com › 2015 › 11 › c-program-check-number-positive-negative-zero.html
C Program to Check Whether a Number is Positive, Negative or Zero
Then we check whether input number is positive, negative or zero using if else ladder statement. ... #include <stdio.h> int main() { int number; printf("Enter a Number\n"); scanf("%d", &number); if(number > 0) { printf("%d is Positive Number", number); } else if (number < 0) { printf("%d is ...
🌐
IncludeHelp
includehelp.com › c-programs › c-program-to-check-number-is-positive-negative-or-zero-using-loop.aspx
C program to check whether number is POSITIVE, NEGATIVE or ZERO
/* C program to check whether number ... int num; char choice; do { printf("Enter an integer number :"); scanf("%d", &num); if (num == 0) printf("Number is ZERO."); else if (num > 0) printf("Number is POSITIVE."); else printf("Number is NEGATIVE."); printf("\n\nWant to check again ...
🌐
Sankalandtech
sankalandtech.com › Tutorials › C › c-positive-negative.html
C Program to check entered number is ZERO, POSITIVE or NEGATIVE until user does not want to quit. using while do while loop
/* C Program to check entered number is ZERO, POSITIVE or NEGATIVE until user does not want to quit. using while loop */ #include <stdio.h> /* C program to check whether number is POSITIVE, NEGATIVE or ZERO until user doesn’t want to exit.*/ int main() { int n; char choice; printf("\n\nWant to check POSITIVE/NEGATIVE Number (press Y/y for 'yes') :"); fflush(stdin); scanf(" %c", &choice); while (choice == 'Y' || choice == 'y') { printf("Enter any number number :"); scanf("%d", &n); if (n > 0) printf("\n %d is POSITIVE Number .",n); else if (n == 0) printf("Number is ZERO."); else printf("\n %d is NEGATIVE Number .",n); printf("\n\nWant to continue again (press Y/y for 'yes') :"); fflush(stdin); /*to clear input buffer*/ scanf(" %c", &choice); /*Here is a space before %c*/ } printf("\nBye Bye!!!"); return 0; }
🌐
WsCube Tech
wscubetech.com › resources › c-programming › programs › positive-negative
C Program to Check Positive or Negative Number (4 Ways)
August 29, 2025 - Learn 4 different ways to check if a number is positive or negative in C programming. Explore various methods to handle number comparisons.
🌐
CodingBroz
codingbroz.com › home › c program to check whether a number is positive or negative
C Program to Check Whether a Number is Positive or Negative - CodingBroz
November 23, 2021 - If the number entered by the user is greater than 0, then it will be a Positive Integer. else if (num < 0) { printf("%d is a Negative Number.", num); } If the number is smaller than 0, then it will be a Negative Number. else { printf("0 is neither ...
🌐
Codeforwin
codeforwin.org › home › c program to check positive negative or zero using switch case
C program to check positive negative or zero using switch case - Codeforwin
July 20, 2025 - So first let us define expressions to check positive, negative or zero. (num > 0) return 1 (true) for positive number, otherwise 0 (false). (num < 0) check negative and return 1 for negative number, otherwise 0.