C代写:CS158 Find The Digits

Introduction

代写一个C语言的小作业,寻找一个数学问题的解。

Problem

Given a positive integer (greater than zero) and a positive digit (1 - 9) find the smallest multiple of the positive integer that is composed only of digits less than or equal to the digit specified by the user.
Example Execution #1:

Enter a positive integer: 7
Enter largest permissible digit: 3
Smallest multiple of 7 containing digits less than or equal to 3 is: 21

Example Execution #2:

Enter a positive integer: 88
Enter largest permissible digit: 5
Smallest multiple of 88 containing digits less than or equal to 5 is: 352

Example Execution #3:

Enter a positive integer: 15
Enter largest permissible digit: 2
Smallest multiple of 15 containing digits less than or equal to 2 is: 120

Example Execution #4:

Enter a positive integer: 12
Enter largest permissible digit: 1
Smallest multiple of 12 containing digits less than or equal to 1 is: 11100

Example Execution #5:

Enter a positive integer: 34
Enter largest permissible digit: 4
Smallest multiple of 34 containing digits less than or equal to 4 is: 34

Example Execution #6:

Enter a positive integer: 789
Enter largest permissible digit: 2
Smallest multiple of 789 containing digits less than or equal to 2 is: 11202222

Additional Requirements

  1. Add the homework assignment header file to the top of your program. A description of your program will need to be included in the assignment header. This particular header can be added to your file by entering hhw while in command mode in vi.
  2. Each example execution represents a single test of your program. The six examples provided imply that the program was run six different times.
    • Your program is expected to accept input and produce output in the same manner demonstrated above.
    • The user will always enter a positive integer followed by a single digit in the range from 1 to 9.
    • Each test case will result in finding a multiple that is less than or equal to INT_MAX as found in the limits.h library.
    • Do not add any “bonus” features not demonstrated in the example executions provided.
  3. Course standards prohibit the use of programming concepts not yet introduced in lecture. For this assignment you can consider all material in the first six chapters of the book, notes, and lectures to be acceptable for use.
    • The use of arrays will result in no credit being awarded for your effort.
  4. For this assignment you will be required to implement the user-defined functions (from chapter 4). Failing to follow course standards as they relate to good user-defined function use will result in a zero for this assignment.
  5. A program MUST compile to be considered for partial credit. The submission script will reject the submission of any file that does not successfully compile on the guru server. The name of the source code file you attempt to submit must be hw05.c, no variation is permitted.

Course Programming and Documentation Standards Reminders

  • Use the course function header (head_fx vi shortcut hfx while in command mode) for every user-defined function in your program.
    • List and comment all parameters to a function, one per line, in the course function header.
    • All function declarations will appear in the global declaration section of your program.
    • The user-defined function definitions will appear in your program after the main function.
  • Indent all code within relevant selection and repetition constructs two additional spaces.
  • Make use of { and } with all relevant selection and repetition constructs.
  • Place a single space between all operators and operands. Comment all variables to the right of each declaration. Declare only one variable per line.
  • Notice that several programs (see program 2-9 on pages 74-75) in the programming text use a single line comment to indicate the start of the local declaration and executable statement sections of the main function.
    • At no point during the semester should these two sections ever overlap. You might consider adopting this habit of commenting the start of each section to help you avoid this mistake.
  • Select meaningful identifiers (names) for all variables and functions in your program.
  • Indent all code found within the main and all user-defined functions exactly two spaces.
  • Control-forcing statements such as exit, break, continue, and the use of multiple return statements in a single function are not acceptable practices according to course standards.
  • Do not single (or double) space the entire program, use blank lines when appropriate.
  • Consider making symbolic/defined constants to represent those values that do not change during the execution of the program.
  • There is no need to include example output with your submission.
  • Remove any diagnostic print statements from your code, even if they are commented out (inactive), unless you believe your program to be logically incorrect or incomplete as a way to demonstrate to your lab instructor how much of the problem you were able to solve and attempted to implement.