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

This commit is contained in:
Vladyslav Korzun 2023-03-02 10:36:56 +00:00
parent 5ca27b2962
commit a7a72ded64

View File

@ -8,6 +8,8 @@
#include <math.h> #include <math.h>
#include <ctype.h>
#define LINE_SIZE 150 #define LINE_SIZE 150
int main(){ int main(){
@ -34,11 +36,17 @@ int main(){
float h = 0; float h = 0;
//float p = 0;
while(stop == 0){ while(stop == 0){
r = fgets(riadok,LINE_SIZE,stdin); r = fgets(riadok,LINE_SIZE,stdin);
assert(r!=NULL); if (r == NULL || !isdigit(*r)) {
break;
}
r2 = atof(riadok); r2 = atof(riadok);
@ -48,14 +56,6 @@ int main(){
i++; i++;
if (r2 == 0){
//printf("Konverzia sa nepodarila alebo v reťazci sa nachádza nula.\n");
stop++;
}
} }
x = mass[0]; x = mass[0];
@ -68,13 +68,13 @@ int main(){
h = mass[j]; h = mass[j];
//printf("h>>> %1.f\n", h); printf("h>>> %1.f\n", h);
if(counter == -1){ if(counter == -1){
vysl = x * h + mass[j + 1]; vysl = x * h + mass[j + 1];
//printf("vysl>>> %1.f\n", vysl); printf("vysl>>> %1.f\n", vysl);
counter++; counter++;
@ -86,7 +86,7 @@ int main(){
vysl = x * vysl + mass[j + 1]; vysl = x * vysl + mass[j + 1];
//printf("vysl22>>>>> %1.f\n", vysl); printf("vysl22>>>>> %1.f\n", vysl);
} }