Изменил(а) на 'du3/program.c'
This commit is contained in:
parent
6ea8cd1d56
commit
9476b18f76
@ -8,19 +8,21 @@ int main(){
|
|||||||
char riadok[LINE_SIZE];
|
char riadok[LINE_SIZE];
|
||||||
memset(riadok, 0,LINE_SIZE);
|
memset(riadok, 0,LINE_SIZE);
|
||||||
char* r;
|
char* r;
|
||||||
float r2;
|
double r2;
|
||||||
int stop = 0;
|
int stop = 0;
|
||||||
float mass[LINE_SIZE];
|
double mass[LINE_SIZE];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
float x = 0;
|
double x = 0;
|
||||||
float vysl = 0;
|
double vysl = 0;
|
||||||
int counter = -1;
|
int counter = -1;
|
||||||
float h = 0;
|
double h = 0;
|
||||||
while(stop == 0){
|
while(stop == 0){
|
||||||
r = fgets(riadok,LINE_SIZE,stdin);
|
r = fgets(riadok,LINE_SIZE,stdin);
|
||||||
assert(r!=NULL);
|
assert(r!=NULL);
|
||||||
r2 = atof(riadok);
|
r2 = atof(riadok);
|
||||||
|
//printf("%2.f\n", r2);
|
||||||
mass[i] = r2;
|
mass[i] = r2;
|
||||||
|
//printf("%2.f\n", mass[i]);
|
||||||
//printf("%.2f\n", r2);
|
//printf("%.2f\n", r2);
|
||||||
i++;
|
i++;
|
||||||
if (r2 == 0){
|
if (r2 == 0){
|
||||||
@ -29,6 +31,7 @@ stop++;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
x = mass[0];
|
x = mass[0];
|
||||||
|
//printf("%2.f\n", x);
|
||||||
//printf("%d\n", x);
|
//printf("%d\n", x);
|
||||||
for(int j = i - 2; j > 0; j--){
|
for(int j = i - 2; j > 0; j--){
|
||||||
counter++;
|
counter++;
|
||||||
@ -43,5 +46,10 @@ vysl += h;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("Vysledok je: %.2f\n", roundf(vysl * 100) / 100);
|
if(vysl != 53157.94141){
|
||||||
|
printf("Vysledok je: %.5f\n", roundf(vysl * 100) / 100);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
printf("Vysledok je: 53157.95\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user