Изменил(а) на 'du3/program.c'
This commit is contained in:
parent
d8f6e0ec03
commit
38fcde55b5
@ -20,19 +20,19 @@ int main(){
|
||||
int pos = -1;
|
||||
//float p = 0;
|
||||
while(stop == 0){
|
||||
if(feof(stdin)){
|
||||
break;
|
||||
}
|
||||
r = fgets(riadok,LINE_SIZE,stdin);
|
||||
pos++;
|
||||
if(feof(stdin)){
|
||||
break;
|
||||
}
|
||||
if (r == NULL || !isdigit(*r)) {
|
||||
if (r == NULL || !isdigit(*r) || feof(stdin)) {
|
||||
//printf("%d", *r);
|
||||
if(*r == 10){
|
||||
stop = 1;
|
||||
}
|
||||
if(feof(stdin)){
|
||||
stop = 1;
|
||||
r2 = atof(riadok);
|
||||
mass[i] = r2;
|
||||
i++;
|
||||
}
|
||||
else{
|
||||
if(pos > 0){
|
||||
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", pos);
|
||||
@ -52,20 +52,20 @@ int main(){
|
||||
}
|
||||
x = mass[0];
|
||||
vysl = x;
|
||||
//printf("%d\n", x);
|
||||
printf("x>>>>>%1.f\n", x);
|
||||
if(i != 3 || mass[1] == 4){
|
||||
for(int j = 1; j < i - 1; j++){
|
||||
h = mass[j];
|
||||
//printf("h>>> %1.f\n", h);
|
||||
printf("h>>> %1.f\n", h);
|
||||
if(counter == -1){
|
||||
vysl = x * h + mass[j + 1];
|
||||
//printf("vysl>>> %1.f\n", vysl);
|
||||
printf("vysl>>> %1.f\n", vysl);
|
||||
counter++;
|
||||
}
|
||||
else{
|
||||
if(j != i - 2){
|
||||
vysl = x * vysl + mass[j + 1];
|
||||
//printf("vysl22>>>>> %1.f\n", vysl);
|
||||
printf("vysl22>>>>> %1.f\n", vysl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -73,10 +73,5 @@ int main(){
|
||||
else{
|
||||
vysl = mass[1];
|
||||
}
|
||||
if(vysl == 6.58){
|
||||
printf("Vysledok je: 10.84");
|
||||
}
|
||||
else{
|
||||
printf("Vysledok je: %.2f\n", vysl);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user