You're pretty rude.

Code:

#include<stdio.h>
#include<stdlib.h>
/*
This program demonstrates recursive functions and dynamic, multi-dimensional pointer arrays.
It will calculate the total factorial value for multiple groups of items.
You enter the total number of items, and the number of groups you will have. Then you enter the
number of items in each group. The program error-checks to make sure the number of items
entered in each groups adds up to be the total number of items.
*/
// Prototypes.
unsigned long factr (unsigned long num_items2, unsigned long num_groups2);
unsigned long factorial_engine (unsigned long n);
void main ()
{
unsigned long num_items = 0;
unsigned long num_groups = 0;
printf ("\n\nHow many items total?\n");
scanf ("%u", &num_items);
printf ("\n\nHow many groups?\n");
scanf ("%u", &num_groups);
if (num_groups > num_items)
{
printf("\n\nError! Can't have more groups than items!\n\n");
exit (1);
}
else
{
factr (num_items, num_groups);
}
}
unsigned long factr (unsigned long num_items2, unsigned long num_groups2)
{
// These are in order of appearance.
unsigned long loop = 0;
unsigned long total = 0;
unsigned long quantity = 0;
unsigned long numerator = 0;
unsigned long denominator = 1;
// Array dimensioning.
unsigned long *group_total;
group_total = malloc (num_groups2*2*sizeof(int));
if(!group_total)
{
puts ("\n\nERROR! Not enough Memory!\n\n");
exit (1);
}
// Array initialization.
for (loop = 1; loop <= num_items2; loop++)
{
group_total[loop][1] = 0;
group_total[loop][2] = 0;
}
loop = 0;
// Array data-entry.
for (loop = 1; loop <= num_groups2; loop++)
{
printf ("\n\nHow many in group %d\n", loop);
scanf ("%u", &quantity);
group_total[loop][1] = quantity;
total = total + quantity;
}
loop = 0;
// Error checking and factorial calculations for each group
if (total = num_groups2);
{
for (loop = 1; loop <= num_groups2; loop++)
{
group_total[loop][2] = factr (quantity);
}
loop = 0;
}
else
{
printf ("\n\nTotal number of items not equal to total items entered!\n\n");
free (group_total);
exit (1);
}
total = 0;
// Final calculations.
numerator = factr (num_items2);
for (loop = 1; loop <= num_groups2; loop++)
{
denominator = denominator * group_total[loop][2];
}
total = numerator / denominator;
printf ("\n\nTotal factorial for this mess: %u\n\n", total);
total = 0;
loop = 0;
free (group_total);
}
// Factorial engine.
unsigned long factorial_engine (unsigned long n)
{
unsigned long answer;
if (n==1) return (1);
answer = n==0 ? 1: n * factr (n - 1); // recursive call
return (answer);
}