|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
void main() { int num; printf("Enter a number: \n"); scanf("%d", &num); if (num > 0) printf("%d is a positive number \n", num); else if (num < 0) printf("%d is a negative number \n", num); else printf("0 is neither positive nor negative"); } |
结果
|
1 2 3 |
Enter a number: -3 -3 is a negative number |