pvjc22/du3/program.c

25 lines
444 B
C
Raw Normal View History

2022-03-17 13:02:02 +00:00
#include <stdio.h>
int main(){
2022-03-18 10:52:18 +00:00
float vxod[999];
2022-03-17 20:45:15 +00:00
int i = 0;
2022-03-18 10:52:18 +00:00
float result = 0;
2022-03-17 20:45:15 +00:00
while(1){
2022-03-18 10:52:18 +00:00
float value = 0;
float r = scanf("%f", &value);
2022-03-17 20:45:15 +00:00
if(r == 1){
vxod[i++] = value;
2022-03-18 10:55:37 +00:00
}else if(r <= 255 && r >= 0){
2022-03-18 10:57:30 +00:00
printf("Nepodarilo sa nacitat polynom na 2 mieste.\n");
2022-03-18 10:56:39 +00:00
break;
2022-03-18 10:55:37 +00:00
}
else{
2022-03-17 20:45:15 +00:00
for(int a = 1; a < i; a++)
result = vxod[0] * result + vxod[a];
2022-03-18 10:52:18 +00:00
printf("Vysledok je: %.2f\n", result);
2022-03-17 20:45:15 +00:00
break;
}
2022-03-17 16:29:23 +00:00
}
2022-03-17 13:02:02 +00:00
return 0;
2022-03-17 20:46:47 +00:00
}