title: Basic Enumeration Efficiency in C
body: <p>I'm trying to get some flying cloud technique and I'm working on these types of problems.  </p>
  
  <p>There were 16 presidents of the Continental Congresses from 1774 to 1788. Each of the five students in a seminar in American history chooses one of these on which to do a report. If all presidents are equally likely to be chosen, calculate the probability that at least two students choose the same president.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main() 
  {
  int tot=0, probc=0, a=1, b=1, c=1, d=1, e=1, cnt=16;
  
  while(e&lt;=cnt)
  {
     while(d&lt;=cnt)
      {
          while(c&lt;=cnt)
          {
              while(b&lt;=cnt)
              {
                  while(a&lt;=cnt)
                  {
                      if(a==b){++probc;}
                      else if(a==c){++probc;}
                      else if(a==d){++probc;}
                      else if(a==e){++probc;}
                      else if(b==c){++probc;}
                      else if(b==d){++probc;}
                      else if(b==e){++probc;}
                      else if(c==d){++probc;}
                      else if(c==e){++probc;}
                      else if(d==e){++probc;}
                      ++a;++tot;
                  }
                  a=1;++b;
              }
              b=1; ++c;
          }
          c=1; ++d;
      }
      d=1;++e;
  }
  printf("%d / %d", probc,tot);
  return 0;
  }
  output:
  524416 / 1048576
  </code></pre>
  
  <p>Any ideas on what would be more efficient, and techniques I could work on and so fourth to make this more logical and less lengthy?  Specicially I could see maybe the loops, or maybe the else if, could I condense these arguments?</p>