C De Faktöriyel Hesaplama Fonksiyonu
C de Faktöriyel Hesaplamak İçin Fonksiyon yazmak istiyorsanız buyrun kodlar:
#include <stdio.h>
int fac(int y);
int main(void){
printf("Val Factorialn");
for(int i = 1; i<=10; i++){
printf("%3d. %12dn", i,fac(i));
}
}
int fac(int y){
int tot = 1;
while(y>0){
tot *= y;
y--;
}
return tot;
}