Изменил(а) на 'du3/program.c'

This commit is contained in:
Yaroslav Orlianskyi 2022-03-18 12:51:17 +00:00
parent b93fc7eaed
commit d9d4265e68

View File

@ -1,22 +1,24 @@
#include <stdio.h> #include <stdio.h>
int main(){ int main(){
char riadok[999];
float vxod[999]; float vxod[999];
int i = 0; int i = 0;
int a = 1;
float result = 0; float result = 0;
while(1){ while(1){
float value = 0;
int* r = *fgets(riadok,999,stdin); float r = scanf("%f", &value);
if(*r != '\n') if(r == 1)
vxod[i++] = *r; vxod[i++] = value;
/*else if(*r <= 255 && *r >= 0){ else if(r <= 255 && r >= 0){
if(i != 0) if(i != 0)
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", i); printf("Nepodarilo sa nacitat polynom na %d mieste.\n", i);
else else
printf("Nepodarilo sa nacitat zaklad x\n"); printf("Nepodarilo sa nacitat zaklad x\n");
break; break;
}*/else{ }else{
for(a = 1; a < i; a++)
printf("%.2f\n", vxod[a]);
for(int a = 1; a < i; a++) for(int a = 1; a < i; a++)
result = vxod[0] * result + vxod[a]; result = vxod[0] * result + vxod[a];
printf("Vysledok je: %.2f\n", result); printf("Vysledok je: %.2f\n", result);