|  |  |  | @ -3,6 +3,46 @@ | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | int main() | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |  |     printf("Hello world!\n"); | 
			
		
	
		
			
				
					|  |  |  |  |     double A, C, p; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     printf("Enter the initial cost of the product: "); | 
			
		
	
		
			
				
					|  |  |  |  |     scanf(" %lf", &A); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     printf("Enter the desired cost of the product: "); | 
			
		
	
		
			
				
					|  |  |  |  |     scanf(" %lf", &C); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     while(A <= C) | 
			
		
	
		
			
				
					|  |  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         printf("The initial cost is already lower or equal to the desired one. \nEnter the desired one again: "); | 
			
		
	
		
			
				
					|  |  |  |  |         scanf(" %lf", &C); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     printf("Enter the percentage reduction in the cost of the product for the year: "); | 
			
		
	
		
			
				
					|  |  |  |  |     scanf(" %lf", &p); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     //printf("A = %lf \nC = %lf \np = %lf \n", A,C,p);
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     for(int i = 1; i <= 10; i++) | 
			
		
	
		
			
				
					|  |  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |  |         A *= (1 - (p / i) / 100); | 
			
		
	
		
			
				
					|  |  |  |  |         printf("A = %lf\n", A); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         if(A < C) | 
			
		
	
		
			
				
					|  |  |  |  |         { | 
			
		
	
		
			
				
					|  |  |  |  |             printf("The cost of the product dropped below the desired cost after %d years\n", i); | 
			
		
	
		
			
				
					|  |  |  |  |             break; | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     if(A > C) | 
			
		
	
		
			
				
					|  |  |  |  |         { | 
			
		
	
		
			
				
					|  |  |  |  |             printf("The cost of the product did not fall below the desired cost\n"); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     printf("Press any key to exit...\n"); | 
			
		
	
		
			
				
					|  |  |  |  |     getchar(); | 
			
		
	
		
			
				
					|  |  |  |  |     getchar(); | 
			
		
	
		
			
				
					|  |  |  |  |     return 0; | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
	
		
			
				
					|  |  |  | 
 |