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
- 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)
- 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;
}
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started