PositiveOrNegative
This commit is contained in:
@@ -16,3 +16,4 @@
|
|||||||
|14 | AgeCheck.c | AgeCheck.exe | WAP to check your age > 18 or not (using if else statement) |
|
|14 | AgeCheck.c | AgeCheck.exe | WAP to check your age > 18 or not (using if else statement) |
|
||||||
|15 | MaximumNo2.c | MaximumNo2.exe | WAP to find out maximum out of two numbers |
|
|15 | MaximumNo2.c | MaximumNo2.exe | WAP to find out maximum out of two numbers |
|
||||||
|16 | MaximumNo4.c | MaximumNo4.exe | WAP to find out maximum out of three numbers using nested if..else |
|
|16 | MaximumNo4.c | MaximumNo4.exe | WAP to find out maximum out of three numbers using nested if..else |
|
||||||
|
|17 | PositiveOrNegative.c | PositiveOrNegative.exe | WAP to find out a given number is positive, negative or 0 |
|
||||||
15
PositiveOrNegative.c
Normal file
15
PositiveOrNegative.c
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
// WAP to find out a given number is positive, negative or 0.
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
int num;
|
||||||
|
printf("Input a number :");
|
||||||
|
scanf("%d", &num);
|
||||||
|
if (num += 0)
|
||||||
|
printf("%d is a positive number \n", num);
|
||||||
|
else if (num == 0) {
|
||||||
|
printf("%d is zero \n", num);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("%d is a negative number \n", num);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
PositiveOrNegative.exe
Normal file
BIN
PositiveOrNegative.exe
Normal file
Binary file not shown.
Reference in New Issue
Block a user