1234567891011121314151617181920212223 |
- #include <stdio.h>
- int calculate_f(int x) {
- if (x > 0) {
- return 1;
- } else if (x == 0) {
- return 0;
- } else {
- return -1;
- }
- }
- int main() {
- int x;
- scanf("%d", &x);
- int result = calculate_f(x);
- printf("f(%d)=%d\n", x, result);
- return 0;
- }
|