Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

(2) f YZ (y, z). Pg45

Answered: 1 week ago

Question

Identify conflict triggers in yourself and others

Answered: 1 week ago