华为机试——删除含7元素和被7整除的元素
C_C++_WP_04. Remove Particular Elements in an Array
- Description:
Input an array, in which each element must be greater than 0 and less than 999. Then, remove following elements:
l Elements that can be evenly divided by 7
l Elements containing the digit 7.
The number of elements left in the array is returned. The order of the remaining elements in the array does not change.
- Function to be implemented:
int vDelete7Data(int arrIn[],int Num, int arrOut[]);
[Input] arrIn: array consisting of integers
Num: number of elements in the array
[Output] arrOut: array with the particular elements removed
The output is the number of elements in the array with the particular elements removed by the function.
[Note] The order of the numbers in the array must not change.
- Example 1
Input: 1,2,3,5,4,6,7,14,10
Output: 1,2,3,5,4,6,10
The value 7 is returned.
- Example 2
Input: 73,64,70,75,6,3
Output: 64,6,3
The value 3 is returned.