pvjc22/du3/program.c

30 lines
587 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;
int a = 1;
2022-03-18 10:52:18 +00:00
float result = 0;
2022-03-17 20:45:15 +00:00
while(1){
float value = 0;
float r = scanf("%f", &value);
if(r == 1)
vxod[i++] = value;
else if(r <= 255 && r >= 0){
2022-03-18 10:59:56 +00:00
if(i != 0)
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", i);
else
2022-03-18 11:00:36 +00:00
printf("Nepodarilo sa nacitat zaklad x\n");
2022-03-18 10:56:39 +00:00
break;
}else{
for(a = 1; a < i; a++)
printf("%.2f\n", vxod[a]);
2022-03-18 11:15:53 +00:00
for(int a = 1; a < i; a++)
2022-03-17 20:45:15 +00:00
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-18 12:52:57 +00:00
}