c program for positive or negative

Solutions on MaxInterview for c program for positive or negative by the best coders in the world

showing results for - "c program for positive or negative"
Isabella
01 Jun 2018
1//Negative or positive
2#include <stdio.h>
3int main()
4{
5    int Num;
6    printf("Test Data: ");
7    scanf("%d", &Num);
8    
9//A negative number is less than 0, so the if suggests that if the program detects any number less than 0, then it must be a negative    
10    if(Num < 0)
11    {
12        printf("%d is a Negative number", Num);
13    }
14//Otherwise, the program will consider the number as positive.
15    else
16    {
17        printf("%d is a Positive number", Num);
18    }
19
20}