What will be the output for the following code?

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

What will be the output for the following code?

Post by answerhappygod »

advertisement


var adpushup = window.adpushup || {};
adpushup.que = adpushup.que || [];
adpushup.que.push(function () {
if (adpushup.config.platform === "MOBILE") {
adpushup.triggerAd("21eae76a-c83f-42b0-aec5-01d590a53f37");
} else if ((window.outerWidth <= 768) || (window.outerWidth == 0)) {
adpushup.triggerAd("21eae76a-c83f-42b0-aec5-01d590a53f37");
}
});
#include<stdio.h>
void combination(int arr[],int n,int r,int index,int aux[],int i);
void print(int arr[], int n, int r)
{
int aux[r];
combination(arr, n, r, 0, aux, 0);
}
void combination(int arr[], int n, int r, int index, int aux[], int i)
{
if (index == r)
{
for (int j=0; j<r; j++)
printf("%d ",aux[j]);
printf(", ");
return;
}
if (i >= n)
return;
aux[index] = arr;
combination(arr, n, r, index+1, aux, i+1);
combination(arr, n, r, index, aux, i+1);
}
int main()
{
int arr[] = {1, 2,2};
int r = 2;
int n = sizeof(arr)/sizeof(arr[0]);
print(arr, n, r);
return 0;
}
a) 1 2, 1 2, 2 2
b) 1 2, 1 2, 2 2 ,
c) 1 2, 2 1, 2 2 ,
d) 1 2, 2 1, 2 2
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!

This topic has 1 reply

You must be a registered member and logged in to view the replies in this topic.


Register Login
 
Post Reply