pvjc24/cv3/program.c

30 lines
424 B
C
Raw Normal View History

2024-02-29 13:23:40 +00:00
#include <stdio.h>
#define SIZE 10
int main() {
2024-03-04 13:14:10 +00:00
int coefs[SIZE];
2024-02-29 13:23:40 +00:00
int x = 0;
2024-03-04 12:55:19 +00:00
int input;
2024-02-29 13:23:40 +00:00
int count = 0;
2024-03-04 13:14:10 +00:00
int length;
int result = 0;
2024-03-04 12:55:19 +00:00
2024-03-04 13:02:52 +00:00
while (count < SIZE && scanf("%d", &input) == 1) {
coefs[count] = input;
count++;
}
2024-03-04 12:55:19 +00:00
2024-03-04 13:14:10 +00:00
length = count;
2024-03-04 13:26:22 +00:00
for (int i = 0; i < length; i ++){
2024-03-04 13:28:23 +00:00
result += coefs[0]*i + coefs[i];
2024-03-04 13:14:10 +00:00
}
printf("\nResult: %d\n", result);
2024-02-29 13:23:40 +00:00
return 0;
}
2024-03-04 13:02:52 +00:00
2024-03-04 13:14:10 +00:00