2 #include <stdlib.h>
3
4 static int sum(int n)
5 {
6 int i, result = 0;
7
8 for (i = 1; i <= n; ++i)
9 result += i;
10 return result;
11 }
12
13 int main(int argc, char **argv)
14 {
15 printf("%d\n", sum(5));
16 printf("%d\n", sum(100));
17 return 0;
18 }
19
20 /*
21 * check-name: sum from 1 to n
22 * check-command: sparsei $file
23 *
24 * check-output-start
25 15
26 5050
27 * check-output-end
28 */
|
2 #include <stdlib.h>
3
4 static int sum(int n)
5 {
6 int i, result = 0;
7
8 for (i = 1; i <= n; ++i)
9 result += i;
10 return result;
11 }
12
13 int main(int argc, char **argv)
14 {
15 printf("%d\n", sum(5));
16 printf("%d\n", sum(100));
17 return 0;
18 }
19
20 /*
21 * check-name: sum from 1 to n
22 * check-command: sparsei --no-jit $file
23 *
24 * check-output-start
25 15
26 5050
27 * check-output-end
28 */
|