Created
November 14, 2016 12:06
-
-
Save cordx56/c169b08fbf77cacfeedaf40c502bbe9b to your computer and use it in GitHub Desktop.
It outputs '56' to your console. That's all.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int math_fact(int n) { | |
int r = 1; | |
for (; n > 0; n--) { | |
r *= n; | |
} | |
return r; | |
} | |
int main() { | |
// 8!/(8-2)! == _8 P _2 | |
int res = math_fact(8) / math_fact(8 - 2); | |
std::cout << res; | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function math_fact($n) { | |
$r = 1; | |
for (; $n > 0; $n--) { | |
$r *= $n; | |
} | |
return $r; | |
} | |
// 8!/(8-2)! == _8 P _2 | |
$res = math_fact(8) / math_fact(8 - 2); | |
print $res; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
# 8!/(8-2)! == _8 P _2 | |
res = math.factorial(8) // math.factorial(8 - 2) | |
print(res) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Print56 { | |
public static void main(String args[]) { | |
// 8!/(8-2)! == _8 P _2 | |
int res = math_fact(8) / math_fact(8 - 2); | |
System.out.print(res); | |
} | |
static int math_fact(int n) { | |
int r = 1; | |
for (; n > 0; n--) { | |
r *= n; | |
} | |
return r; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment