pvjc22/du3/program.c

28 lines
528 B
C
Raw Normal View History

2022-03-17 13:02:02 +00:00
#include <stdio.h>
int main(){
2022-03-18 12:41:53 +00:00
char riadok[999];
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 12:41:53 +00:00
2022-03-18 12:50:52 +00:00
int* r = *fgets(riadok,999,stdin);
2022-03-18 12:41:53 +00:00
if(*r != '\n')
vxod[i++] = *r;
/*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;
2022-03-18 12:41:53 +00:00
}*/else{
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-17 20:46:47 +00:00
}