Computer Science, asked by aayushhedaoo9910, 1 year ago

Given an integer total, calculate the number of possible ways to represent total, as a sum of integers between 1 and k inclusive. Javascript

Answers

Answered by faridiyahya43
0

Answer:

there is no value because of infinite loop or no.

Answered by stefangonzalez246
0

Different ways to represent N as sum of K non-zero integers

JAVA Program:

import java.io.*;

class GFG

{

Static int binomialCoeff ( int n, int k)

{

int c[] [] = new[ n+1] [k+1];

int i, j;

for ( i=0; i<=n; i++)

{

for (j=0; j<= Math.min(i, k); j++)

{

if(j==0|| j==i)

c[i][j] = 1;

else

c[i][j] = c[i - 1] [j - 1] + c[i -1][j];

}

}

return C[n] [k];

}

public static void main (String[] args)

{

int n=5, k=3;

system.out.println( "total number of "+"different ways are " + binomialCoeff(n-1, k-1));

}

}

Output

The total number of different ways are 6

To Learn More...

  • brainly.in/question/13908921

Similar questions