Mathc initiation/a242
Installer et compiler ces fichiers dans votre répertoire de travail.
c00b.c |
---|
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "x_hfile.h"
/* ------------------------------------ */
int main(void)
{
double n=3;
double k=2;
clrscrn();
printf(" n = %+.0f \n"
" k = %+.0f \n"
" n-k = %+.0f \n\n"
" factorial( n) = %+.0f\n"
" factorial( k) = %+.0f\n"
" factorial(n-k) = %+.0f\n\n\n",
n,k,(n-k),
factorial(n),
factorial(k),
factorial(n-k) );
printf(" Binomial Coefficient \n\n\n"
" |n| n! \n"
" |k| = --------- \n"
" k! (n-k)!\n\n\n"
" Binomial(%+.0f,%+.0f) = %+.0f\n\n\n",
n,
k,
binomial(n,k));
stop();
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
n = +3
k = +2
n-k = +1
factorial( n) = +6
factorial( k) = +2
factorial(n-k) = +1
Binomial Coefficient
|n| n!
|k| = ---------
k! (n-k)!
Binomial(+3,+2) = +3
Press return to continue.