By DePaul Dimadis
Choose your prefered Language: greek_flag uk_flag

The length of time and the duration of maintenance of a machine tool (in hours) are known for each of N time periods (N = known).

Write a C language program that will insert these elements into two one-dimensional Arrays.
The manufacturer wants the total maintenance time not to exceed 15% of the total machine tool run time. For these reasons, it wants to know what is the current total running time and the current total maintenance period for each period of time. The program should display the data as well as the values ​​in the example below, up to that time when the total maintenance period is for the first time less than 15% of the total operating time.

Example:

TIME PERIOD 1 2 3 4 5  
Function 150 110 140 130 ...  
Current total function 150 260 400 530    
Maintenance 28 22 20 5 ...  
Current total maintenance 28 20 70 75    
% total maintenance / total function 18.6 19.2 17.5 14.1