Question

In: Computer Science

The service department of a small city needs your help in solving the problem of assigning short phone numbers to its Fire,Sanitation, and Parks and Recreationdepartments.

Solve in C++

The service department of a small city needs your help in solving the problem of assigning short phone numbers to its Fire,Sanitation, and Parks and Recreationdepartments.

The phone numbers to be considered consist of three distinct digits, each ranging from 1 to 7. The sum of the selected three digits must be equal to 12. The Fire Department requires at least four phone numbers which must begin with the same digit, which in turn must be an even number.

Solutions

Expert Solution

Screenshot of code:

output:

code:

#include
using namespace std;
typedef long long ll;
int main()
{
ll i,j,k;
i=2;
cout<<"choose any four from these:\n";
for(j=i+1;j<=12;j++)
{
k=(12-(i+j));
if((k>=1&&k<=12)&&(k!=i)&&(k!=j))
cout< }
}


Related Solutions

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT