25 lines
475 B
C
25 lines
475 B
C
#include <stdio.h>
|
|
#include "tools.h"
|
|
#include "exp_weigh_avg.h"
|
|
|
|
/*
|
|
Çàäàíèå 38
|
|
Ïðèìåð:
|
|
5 4 3 2 1 è ëÿìáäà: 0.5
|
|
Îòâåò: 1.83...
|
|
*/
|
|
|
|
int main(void) {
|
|
double lambda;
|
|
FILE * file = getFile();
|
|
|
|
printf("Enter lambda: ");
|
|
scanf("%lf", &lambda);
|
|
if (betweenZeroOne(lambda) == FALSE) {
|
|
printf("Lambda is not between 0 to 1!");
|
|
return -1;
|
|
}
|
|
|
|
printf("The exponentially weighted average is %lf\n", expWeigthAvg(file, lambda));
|
|
return 0;
|
|
}
|