Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a program in c++ to answer the following questions: Is it possible to fin

ID: 3748574 • Letter: D

Question

Design a program in c++ to answer the following questions:

Is it possible to find a permutation for the number 123456789 such that the left most digit is evenly divisible by 1, the 2 most left digits are evenly divisible by 2, the 3 left most digits are divisible by 3 and so on?

For example, in 123456789, 1 is evenly divisible by 1, 12 is evenly divisible by 2, 123 is evenly divisible by 3, but because 1234 is not evenly divisible by 4 this number is not a solution to the question.

Second, is it possible to find a similar permutation given the number 1234567890? Finally, is it possible to find a similar permutation for any of the given hexadecimal numbers, 1234567890AB, 1234567890ABC, 1234567890ABCD, 1234567890ABCDE, 1234567890ABCDEF?

program must provide the following functionality and adhere to the following constraints:

program should output The count of the possible solutions for 1,2,3,4,5,6, and 7 digit numbers using the digits 1-9 Example: For a 1 digit number there are 9 possible solutions

All possible solutions for 8 and 9 digit numbers in decimal format using the digits 1-9

All possible solutions for 10 digit numbers in decimal format using the digits 0-9 All possible solutions for 11,12,13,14,15, and 16 digit numbers in hexadecimal format using the digits 0-F

No digit can be used more than once per number

All output should be outputted to the terminal You may not hardcode the solutions to these questions into your program. The solution must be determined as a result of your program checking numbers

Explanation / Answer

#include int main(void) { long i,j,n,c=0; for (i=1000000080; i1; n/=10,j--) if (n%j) break; if (j==1) { c++; printf("%ld ",i); } } printf(" Total: %ld ",c); return 0; } // Output: 1020005640 1020061620 1020068010 ... 9876062430 9876069630 9876545640
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote