27 lines
358 B
C
27 lines
358 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int main() {
|
||
|
int n; /* Number */
|
||
|
|
||
|
/* Prompt the user */
|
||
|
printf("Enter an integer: ");
|
||
|
scanf("%d", &n);
|
||
|
|
||
|
/* Determin whether or not the number is odd */
|
||
|
if (n / 2 != n / 2.0) /* Should have used remainder */
|
||
|
printf("%d is odd.\n", n);
|
||
|
else {
|
||
|
printf("%d is not odd.\n", n);
|
||
|
|
||
|
exit(1);
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|