Пример на C 1: /*
2: * Code style example
3: * (c) dluciv 2008
4: * */
5: #include <stdio.h>
6: #include <mem.h>
7:
8: /* useless macro */
9: #define N -1
10:
11: /* useless global variable */
12: int x = 0;
13:
14: /*
15: returns x-y without real substraction
16: */
17: int sub(int x, int y)
18: {
19: return x + 1 + (~y); /* or may be x + 1 + (N^y) */
20: }
21:
22: /*
23: main routine.
24: asks for x and y and prints x-y
25: */
26: int main()
27: {
28: int x, y;
29:
30: puts("Input x, then y");
31: scanf("%d %d", &x, &y);
32: printf("%d\n", sub(x, y));
33: return 0;
34: }
|
|