title: Java program to calculate the combinations function
body: <p>For my programming class I have to make a program that calculates the combinations function C(n,k) = n!/(k!*(n-k)!) by using a main method to deal with input/output, a method to compute the factorial, and a method to compute the combinations function. Here's my code:</p>
  
  <pre><code>import java.util.Scanner;
  public class Combinations {
  
      public static void factorials (int set, int objects) {
          Scanner keyboard = new Scanner(System.in);
          int n = set;
          int k = objects;
          int c = (n-k);
          int factorial1 = 1;
          int factorial2 = 1;
          int factorial3 = 1;
          while (n &gt; 0) {
              factorial1 = factorial1 + s;
              n = n++;
          }//while loop
          while (k &gt; 0) {
              factorial2 = factorial2 + o;
              k = k++;
          }//while loop
          while (c &gt; 0) {
              factorial3 = factorial3 + c;
              c = c++;
          }//while loop
          System.out.println(Combinations(factorial1,factorial2,factorial3));
      }//method factorials
      public static int Combinations (int set, int objects, int x){
          int n = set;
          int k = objects;
          int c = x;
          int combination;
          combination = n/(k*c);
          return combination;
      }//method Combinations
      public static void main(String[] args) {
          Scanner keyboard = new Scanner(System.in);
          System.out.println("Enter the number of integers in a set: ");
          int n = keyboard.nextInt();
          System.out.println("Enter the number of objects to be chosen from the set: ");
          int k = keyboard.nextInt();
          System.out.println(factorials(n,k));
      }//method main
  
  }//class
  </code></pre>
  
  <p>My problem is that I'm getting an error message for <code>System.out.println(factorials(s,o));</code> - "The method println(boolean) in the type PrintStream is not applicable for the arguments (void)". I have no idea why it's saying this. Help? </p>