This is the code I wrote for printing if the value of r is 3

import java.util.Scanner;
public class ncr
{
public static void main(String args[])
{
//Scanner s =new Scanner(System.in);
//int n,r;
//System.out.println("Eneter the value of n");
//n=s.nextInt();
//System.out.println("Enter the value of r");
//r=s.nextInt();
//System.out.println("Enter the number");
String[] number = {"1","2","3","4","5"};
for(int i=0;i<number.length;i++)
{
for(int j=i+1;j<number.length-1;j++)
{
int k=j+1;
System.out.println(number[i]+""+number[j]+""+number[(j+1)]);
}
}
}
}

I want to enhance this to get for any r using the same logic.......can u guys give any idea

Guys wht is this........I have posted ages ago and u guys cant help with this or wht.........sorry if im rude..........i tried my best......but im not able to proceed further.......and this is not my homework or anything.......its just something tht im interested in doing.........jus gimme a hint on how to proceed and ill do it......merci beacoup

Guys wht is this........I have posted ages ago and u guys cant help with this or wht.........sorry if im rude..........i tried my best......but im not able to proceed further.......and this is not my homework or anything.......its just something tht im interested in doing.........jus gimme a hint on how to proceed and ill do it......merci beacoup

Is your question regarding implementing the algorithm or writing the algorithm?

Hint:
This is a well established math algorithm; so why not take one of the existing methods and convert it to Java?

i tried searching for the algorithm but........there were actually some pretty wierd stuff tht i saw....so could u please post some links to the algorithm if u know any

and like i already said i want the algorithm to be able to generate the combinations and just not calculate the number of possible combinations as its pretyy easy using
n!/r!(n-r)!

If you don't understand the algorithm...how are you going to implement it? Take the time to write out manually (yes pen and paper) the algorithm step by step until you understand it. Convince yourself you know how it works, then start writing code.