C_CPP/01_ENV/func1.c

26 lines
424 B
C
Raw Normal View History

2018-03-12 22:29:27 +01:00
#include <stdio.h>
2018-03-12 22:51:08 +01:00
#include <math.h>
2018-03-12 22:29:27 +01:00
2018-03-13 22:15:00 +01:00
int func1(int x) {
2018-03-13 12:50:42 +01:00
return (x-2)*(x-4)*(x-11)*(x-18);
2018-03-12 15:20:16 +01:00
}
2018-03-12 21:11:29 +01:00
int func2(int x) {
2018-03-12 23:17:36 +01:00
return pow(x, 4) - 5 * pow(x, 3) + pow(x, 2) + 5;
2018-03-12 21:11:29 +01:00
}
2018-03-13 12:50:42 +01:00
void recurse1(int count) {
2018-03-12 22:29:27 +01:00
if(count >= 0) {
2018-03-13 12:50:42 +01:00
printf(" %d", func2(count));
recurse1(count - 1);
}
2018-03-12 21:11:29 +01:00
}
2018-03-13 12:50:42 +01:00
void recurse2(int count) {
2018-03-12 22:29:27 +01:00
if(count >= 0) {
2018-03-13 12:50:42 +01:00
recurse1(count - 1);
printf(" %d", func2(count));
}
}