Question: Write a program that takes an integer from the user and prints all prime numbers up to that integer (you may or may not include

  1. Write a program that takes an integer from the user and prints all prime numbers up to that integer (you may or may not include the input integer itself).

(25)

  1. The following program increments all elements of the array arr by 1 and prints the updated array. Complete the function void inc (void *ptr, int size) given in the following code.

You are not allowed to change the main() function and the declaration of the function void inc (void *ptr, int size).

(25)

#include

using namespace std;

void inc (void *ptr, int size){

/*write your code here */

}

int main (){

int arr[100]={};

int size = 100;

inc ((void *)arr,size);

return 0;

}

  1. The following program increments all elements of the array arr by 1 and prints the updated array. Complete the function void inc (int &ptr, int size) given in the following code.

You are not allowed to change the main() function and the declaration of the function void inc (int &ptr, int size).

(25)

#include

using namespace std;

void inc (int &ptr, int size){

/*write your code here */

}

int main (){

int arr[100]={};

int size = 100;

inc (arr[0],size);

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!