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

This commit is contained in:
Andrii Hermaniuk 2022-03-17 20:49:06 +00:00
parent eaa2b1b58b
commit d338ee0fd6

View File

@ -6,7 +6,7 @@
int main(){ int main(){
char pol[SIZE]; char pol[SIZE];
memset(pol,' ',SIZE); memset(pol,'\0',SIZE);
pol[SIZE]='\0'; pol[SIZE]='\0';
int ch=0; int ch=0;
@ -17,8 +17,13 @@ int main(){
pol[idx]=ch; pol[idx]=ch;
} }
int koef=0; int koef=-1;
for(int i=0;i<strlen(pol);i++)if(pol[i]=='\n')koef++;
for(int i=0;i<strlen(pol);i++){
if(pol[i]=='\n')continue;
for(int i2=0; pol[i]!='\n';i++);
koef++;
}
float x=0; float x=0;
char *end = NULL; char *end = NULL;
@ -38,7 +43,6 @@ int main(){
num+=p*n; num+=p*n;
} }
//num=34.577;
num=round(num*100)/100; num=round(num*100)/100;
printf("%.2f\n", num); printf("%.2f\n", num);