Update 'du3/program.c'

This commit is contained in:
Anzhelika Nikolaieva 2023-03-07 22:30:34 +00:00
parent 7b1baf6977
commit ed0424d4c6

View File

@ -5,21 +5,20 @@
#define VELKOST_POLA 50 #define VELKOST_POLA 50
int main(){ int main(){
char rip[SIZE]; char rip[VELKOST_POLA];
memset(rip, '\0', SIZE*sizeof(char)); memset(rip, '\0', SIZE*sizeof(char));
int a = 0; int a = 0;
for(int b = 0; 1; b++){ for(int b = 0; 1; b++){
a = getchar(); a = getchar();
if(a == EOF || a == '') if(a == EOF || a == '')break;
break;
rip[b] = a; rip[b] = a;
} }
for(int c = 0, d = 0; c < strlen(rip); c++){ for(int c = 0, d = 0; c < strlen(rip); c++){
if(rip[c] == '\n'){ if(rip[c] == '\n'){
d++; d++;
} }
else if((rip[c]<='10'&&rip[c]>='0') || (rip[c]=='.') || (rip[c]==EOF) || (rip[c]=='')); else if((rip[c]<='6'&&rip[c]>='0') || (rip[c]=='.') || (rip[c]==EOF) || (rip[c]==' '));
else if(d == 0){ else if(d == 0){
printf("Nepodarilo sa nacitat zaklad x\n"); printf("Nepodarilo sa nacitat zaklad x\n");
return 0; return 0;
@ -33,7 +32,7 @@ int kofi = -1;
for(int c = 0; c < strlen(rip); c++){ for(int c = 0; c < strlen(rip); c++){
if(rip[c] == '\n') if(rip[c] == '\n')
continue; continue;
else for(int c2 = 0; rip[c]!='\n'; c++; c2++); else for(int c2=0; rip[c]!='\n'; c++, c2++);
kofi++; kofi++;
} }
long double x = 0; long double x = 0;
@ -51,10 +50,10 @@ for(int c = 0; c < kofi; c++){
d = dop(x,(kofi-c)-1); d = dop(x,(kofi-c)-1);
n+ = d*f; n+=d*f;
} }
n = round(n*100)/100; n = round(n*100)/100;
printf("Vysledok je: %.2Lf\n", n); printf("Vysledok je: %.2Lf\n", n);
return STOP; return EXIT_SUCCES;
} }