Computer Science, asked by ankushchakraborty568, 4 months ago

print the series in Java 11 110 1110 ​

Answers

Answered by Aishwarya3355
0

Answer:

/ java program to print all N-bit binary

import java.io.*;

class GFG {

// function to generate n digit numbers

static void printRec(String number,

int extraOnes,

int remainingPlaces)

{

// if number generated

if (0 == remainingPlaces) {

System.out.print(number + " ");

return;

}

// Append 1 at the current number and

// reduce the remaining places by one

printRec(number + "1", extraOnes + 1,

remainingPlaces - 1);

// If more ones than zeros, append 0 to the

// current number and reduce the remaining

// places by one

if (0 < extraOnes)

printRec(number + "0", extraOnes - 1,

remainingPlaces - 1);

}

static void printNums(int n)

{

String str = "";

printRec(str, 0, n);

}

// Driver code

public static void main(String[] args)

{

int n = 4;

// Function call

printNums(n);

}

}

// This code is contributed by vt_m

if it helped you please mark BRAINLIST。◕‿◕。

Answered by ggjkiukiu
0

Answer:

Which of the following correctly represents the model?

Select one:

11 122 = 1110

1 110 = 1110

1 110 = 1122

1 122 = 1110

Assessment question image

Explanation:

Similar questions