Program Bilangan Kombinasi C++
#include <stdio.h> long int faktorial(int); int permutasi(int, int); int kombinasi(int, int); main () { int n, r; printf("MENCARI PERMUTASI DAN KOMBINASI\n"); printf("RUMUS Permutasi : P (n, r) = n! / (n-r)!\n"); printf("RUMUS Kombinasi : C(n, r)=n!/r!(n-r)!\n"); printf("\nMasukkan nilai n = "); scanf("%d", &n); printf("\nMasukkan nilai r = "); scanf("%d", &r); printf("\n n = %d r = %d \n",n,r); printf("\n%d data dipermutasikan %d = %d\n", n, r, permutasi(n,r)); printf("\n%d data dikombinasikan %d = %d\n\n", n, r, kombinasi(n,r)); } long int faktorial(int x) { int f...
Komentar
Posting Komentar