Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int numMult3(int nums[], int size);
- void removeAllMult3 (int nums[], int &size);
- void printArray(int nums[], int size);
- //////////////////////////////////////////////////////////////////////
- int main() //
- {
- int nums[100] = {30, 7, -21, 17, 10, 15, 18, 71, 4, 11, -40, 63};
- int size = 12;
- printArray(nums, size);
- cout << "\nThere are " << numMult3(nums, size)
- << " integers which are multiples of 3. \n" << endl;
- /*
- removeAllMult3(nums, size);
- printArray(nums, size);
- cout << "\nThere are " << numMult3(nums, size)
- << " integers which are multiples of 3. \n" << endl;
- */
- return 0;
- }
- ////////////////////////////////////////////////////////////////////// complete this function
- int numMult3(int nums[], int size) //
- {
- int c = 0;
- for(int i = 0; i < size; i++)
- {
- if(nums[i] % 3 == 0)
- {
- c ++;
- }
- }
- return c;
- }
- ////////////////////////////////////////////////////////////////////// complete this function
- void removeAllMult3(int nums[], int & size) //
- {
- }
- ///////////////////////////////////////////////////////////
- void printArray(int *nums, int size) //
- {
- for (int i = 0; i < size; i++)
- {
- cout << nums[i] << ", ";
- } cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement