Question #44719

Worker A can do a job in 15 days while worker B can do the same job in 20 days. Write a
program to calculate the total number of days required to finish the work if both the workers work
simultaneously.

Expert's answer

using System;

namespace Q44719

{

class Program

{

static void Main(string[] args)

{

int A_work = 15;

int B_work = 20;

Console.WriteLine("If worker A can do a job in {0} days",A_work);

Console.WriteLine("while worker B can do the same job in {0} days", B_work);

Console.WriteLine("So the total number of days required to finish the work ");

Console.WriteLine("if both the workers worksimultaneously is {0:#.##}", 1/(1/(double)A_work + 1/(double)B_work));

Console.ReadKey();

}

}

}

namespace Q44719

{

class Program

{

static void Main(string[] args)

{

int A_work = 15;

int B_work = 20;

Console.WriteLine("If worker A can do a job in {0} days",A_work);

Console.WriteLine("while worker B can do the same job in {0} days", B_work);

Console.WriteLine("So the total number of days required to finish the work ");

Console.WriteLine("if both the workers worksimultaneously is {0:#.##}", 1/(1/(double)A_work + 1/(double)B_work));

Console.ReadKey();

}

}

}

## Comments

## Leave a comment