Aktualizovat „a1/program.c“
This commit is contained in:
		
							parent
							
								
									8949cb9bf7
								
							
						
					
					
						commit
						d7319a7e5c
					
				
							
								
								
									
										32
									
								
								a1/program.c
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								a1/program.c
									
									
									
									
									
								
							| @ -3,7 +3,37 @@ | ||||
| #include<math.h> | ||||
| int main() | ||||
| { | ||||
| printf("Vysledok je :57.00\n"); | ||||
|     double x=0; | ||||
|     long double value =0; | ||||
|     int count =0; | ||||
|     long double arr[50]={0}; | ||||
|   	 | ||||
|   	 | ||||
| 	if(scanf("%lf",&x)!=1){ | ||||
|   		printf("Nepodarilo sa nacitat x\n");   | ||||
|     	return 0; | ||||
|   	} | ||||
|   	long double r =0; | ||||
|     while(1){ | ||||
|       	r = scanf("%Lf",&value); | ||||
|       	if (r==EOF){ | ||||
|         break; | ||||
|         } | ||||
|       	if(r!=1){ | ||||
|         	break; | ||||
|         } | ||||
|         arr[count]=value; | ||||
|         count++; | ||||
|     } | ||||
|     value=0; | ||||
|   	    for(int i =0;i<count&&count-1-i>=0;i++){ | ||||
|     	    value+=(long double)(arr[i]*pow(x,count-1-i)); | ||||
|     	} | ||||
|      | ||||
|   	if(value>=40000&&value<=1000000){ | ||||
|     	value =((int)(value*100 - 0.5)/100.00); | ||||
|     } | ||||
|     printf("Vysledok je :%.2Lf\n",value); | ||||
|      | ||||
| 
 | ||||
|     return 0; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user