Learning Goal: I’m working on a c programming project and need a sample draft to

Learning Goal: I’m working on a c programming project and need a sample draft to help me learn.##1. Given an array of length, write a program that finds all the integers in the range [1, n] that do not appear in a. For example,if an input array of length 5contains {4, 3, 3, 2, 2}.The output willbe1 and5, all the integers in the range [1, 5] that do not appear in the input array. Example input/output#1:Enter the length of the input array:4Enter the elements of the input array: 2 41 4Output: 3Example input/output#2:Enter the length of the input array:8Enter the elements of the input array: 4 3 7 1 3 2 8 2Output: 5 61)Name your program arrays1.c.2)In the main function, the program will ask the user to enter the length of the array and the elements of the array. Assume the elements entered are in the range of[1,n], where n is the length of the array.3)Include the function find()in the program.Thefind()function finds all the integers in the range [1, n] that do not appearin a.void find(int a[],int n, int b[]);Array b should be of size n and contains 0s and 1s. An element of bis 1 if the (index of that element + 1) appears ina, and 0 otherwise.For example, an input array of length 5contains {4, 3, 3, 2, 2}, array b will be {0, 1, 1, 1, 0}.4)The main function calls the find function and displays the output.##2. Write a program that checks if two arrays of the same length match after some number of shifts on the first array. A shift on an array means moving the leftmost element to the rightmost position. For example, if array contains {4, 6, 1, 2}, then it will be {6, 1, 2, 4} after one shift. If array b contains {1, 2, 4, 6}, then array matches array bafter 2 shifts. Your program will display “true”if and only if array a can become array b after some number of shift on a. Your program will display “false” otherwise.Example input/output#1:Enter the length of the input array:4Enter the elements of the first array: 2 81 4Enter the elements of the second array: 1 4 8 2Output: falseExample input/output#2:Enter the length of the input array:5Enter the elements of the first array: 4 6 7 1 3Enter the elements of the second array: 1 3 4 6 7Output: true1)Name your program arrays2.c.2)In the main function, the program will ask the user to enter the length of the arrays and the elements of each array.3)Include the function shift()in the program.Theshift()functionmovesthe leftmost elementofarrayato the rightmost position.void shift(int a[],int n);4)The main function calls the shift function, evaluates the arrays, and displays the result.#Programming Style Guidelines:1. Your program should begin with a comment that briefly summarizes what it does. This comment should also include your name.2. In most cases, a function should have a brief comment above its definition describing what it does. Other than that, comments should be written only needed in order for a reader to understand what is happening.3. Variable names and function names should be sufficiently descriptive that a knowledgeable reader can easily understand what the variable means and what the function does. If this is not possible, comments should be added to make the meaning clear.4.Use consistent indentation to emphasize block structure.5.Full line comments inside function bodies should conform to the indentation of the code where they appear.6. Macro definitions (#define) should be used for defining symbolic names for numeric constants. For example: #define PI 3.1415927. Use names of moderate length for variables. Most names should be between 2 and 12 letters long.8.Use underscores to make compound names easier to read: tot_volor total_volumnis clearer than totalvolumn.
Requirements: not long not short

Leave a comment

Your email address will not be published. Required fields are marked *