This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ncrease, which we know nobody will be able to cheat in. So please do yourself a favor, and don’t “help out” your friends, because this help will backfire on them in the midterm and final when they wont be able to code to save their lives. Please do your own work, and encourage others to do so. DC notices for cheating cases on Assignment 1 coming soon J༄. Seriously, look forward to them. Task 1 – Combinatorics Write a function that takes in an integer N, and outputs the factorial of N (mathematically written as N!). For those who do not know what a factorial is, please have a look at the following link: http://en.wikipedia.org/wiki/Factorial. Your function should have the following signature: int fact(int n); A function signature is simply the name of the function, its return type and its input parameters. Once your factorial function is working perfectly, implement the following two functions: int perm(int n, int r);
int comb(int n, int r); The perm function should output the total number of permutations of r objects taken without replacement from a set of n objects. The comb function should output the total number of combinations of r objects taken from a set of n objects. For those of you who do not know what permutations and combinations are, please have a look at the following link:...
View
Full
Document
This homework help was uploaded on 03/02/2014 for the course CS 200 taught by Professor Fareedzaffar during the Winter '11 term at Lahore University of Management Sciences.
 Winter '11
 FareedZaffar

Click to edit the document details