Initialization
This commit is contained in:
parent
bff9910943
commit
c7ef54ba95
@ -1,5 +1,4 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#define SIZE 100
|
#define SIZE 100
|
||||||
|
|
||||||
@ -11,19 +10,7 @@ int main() {
|
|||||||
int length = 0;
|
int length = 0;
|
||||||
double result = 0.0;
|
double result = 0.0;
|
||||||
|
|
||||||
while (count < SIZE)
|
while (count < SIZE && scanf("%lf", &input) == 1) {
|
||||||
{
|
|
||||||
if (coefs[count] == '\n')
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
else if (scanf("%d", &input) != 1)
|
|
||||||
{
|
|
||||||
printf("Nepodarilo sa nacitat polynom na %d mieste.", count);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
coefs[count] = input;
|
coefs[count] = input;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@ -32,14 +19,11 @@ int main() {
|
|||||||
|
|
||||||
length = count;
|
length = count;
|
||||||
|
|
||||||
for (int i = 1; i < length; i ++)
|
for (int i = 1; i < length; i ++){
|
||||||
{
|
result = result * x + coefs[i];
|
||||||
result = result * x + coefs[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Vysledok je: %.2lf\n", result);
|
printf("Vysledok je: %.2lf\n", result);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user