Users Online

· Guests Online: 32

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

03 C Program to Check if a given Integer is Positive or Negative

This C Program checks if a given integer is positive or negative. Here if a number is greater than 0 then that number is a positive number. If a number is less than 0 then the number is negative number.
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.

/*
* C program to check whether a given integer is positive
* or negative
*/
#include

void main()
{
int number;

printf("Enter a number \n");
scanf("%d", &number);
if (number >= 0)
printf("%d is a positive number \n", number);
else
printf("%d is a negative number \n", number);
}

$ cc pgm5.c
$ a.out
Enter a number
-10
-10 is a negative number

$ a.out
Enter a number
45
45 is a positive number

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 0.68 seconds
10,254,887 unique visits