Aktualizovat „a1/program.c“

This commit is contained in:
Bohdan Yanchyk 2020-03-15 17:57:27 +00:00
parent 085d44f4be
commit 1f99198196

View File

@ -6,18 +6,18 @@ int main()
double x=0; double x=0;
long double value =0; long double value =0;
int count =0; int count =0;
double arr[50]={0}; long double arr[50]={0};
scanf("%lf",&x); scanf("%lf",&x);
while(scanf("%Lf",&value)!=EOF){ while(scanf("%Lf",&value)!=EOF){
if(isalpha(value)!=0){ //if(isalpha(value)!=0){
return 0; // return 0;
} //}
arr[count]=(double)value; arr[count]=value;
count++; count++;
} }
value=0; value=0;
for(int i =0;i<count&&count-1-i>=0;i++){ for(int i =0;i<count&&count-1-i>=0;i++){
value+=arr[i]*pow(x,count-1-i); value+=(long double)(arr[i]*pow(x,count-1-i));
} }
if(value>=40000&&value<=1000000){ if(value>=40000&&value<=1000000){