2). Jane Walker, the manager of a construction company in a commercial city has his team working on a project. The team members work on many tasks. He divided the work such as the one third of his team works on design, half of the team is responsible for construction and the left over members in the team takes care of the maintenance. Write a C program using the appropriate variables and expressions as per the given data, read the number of members in the team and the number of days allotted for the completion of project. Display the complete schedule of the team as per the assigned number of days in the scenario to finish the project. Sample Input and Output: Enter the number of days required to complete the project:25 Enter the team size:50 For a team having 50 members, 16 people will work on design 25 people will be responsible for construction and 9 takes care of maitenance of the project that shall be completed in 25 days. ...Program finished with exit code 0 Press ENTER to exit console.]
use c_compiler
- Take a variable to store the number of days.
- Take a variable to store the size of the team.
- Take a variable to store the one-third of the team.
- Take a variable to store half of the team.
- Take a variable to store the reaming people of the team.
- Input the number of days.
- Input the size of the team.
- Divide the size of the team by 3 to get the one-third of the team.
- Divide the size of the team by 2 to get the half of the team.
- Subtract the one-third from the half to get the remaining of the team.
- Print the values.
#include <stdio.h>
int main(void)
{
int days; // number of the days
int teamSize; // size of the team
int oneThird; // one third of the team
int half; // half of the team
int remaining; // remaining people of the team
// inserting the days
printf(" Enter the number of days required to complete the project:");
scanf("%d", &days);
// inserting the team size
printf(" Enter the team size:");
scanf("%d", &teamSize);
// calculating the one third of the team
oneThird = teamSize / 3;
// calculating the half of the team
half = teamSize / 2;
// calculating the remaining people of the team
remaining = half - oneThird;
// printing the data
printf("\n\n For a team having %d members,\n", teamSize);
printf("\n %d people will work on design\n", oneThird);
printf("\n %d people will be responsible for construction and\n", half);
printf("\n %d takes care of maintenance of the project that shall be completed in %d days.", remaining, days);
}
Step by step
Solved in 4 steps with 1 images