summaryrefslogtreecommitdiff
path: root/6p3.cpp
blob: b6532899e5dec6a00b9b3e2a6270e34f3294ee1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>

/*
 *
 * 6.3
 *
 *
 */

int fact(int val) {

	int ret = 1;
	while(val > 1) {
		ret *= val--;
	}
	
	return ret;
}

int main () {

	std::cout << fact(5) << std::endl;
	return 0;
}