/*********************************************************** workrate-2people.ch Work Problems (2 Workers) Calculates the time that it takes for two workers that work at different rates to complete the job ************************************************************ Copyright 2014 SoftIntegration Inc. http://www.softintegration.com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 ***********************************************************/ // initialize variables double t1, t2; double work_per_hour, hours_to_complete; // prompt users to enter work rates for each worker printf("How much time does it take the first person to do the job? "); scanf("%lf", &t1); printf("How much time does it take the second person to do the job? "); scanf("%lf", &t2); // calculate the work done per hour work_per_hour = 1.0/t1 + 1.0/t2; // calculate hours to complete the job hours_to_complete = 1.0 / work_per_hour; // print the answer printf("Together, they finished in %lf hours\n", hours_to_complete);