Pages

Sunday, March 26, 2017

Script C++ Faktorial

Script C++ Faktorial




#include<stdio.h>
#include<conio.h>

long faktor(int n)
{
if(n==0)return 1;
else return n*faktor(n-1);
}

void main()
{

int n;

printf("masukkan n : ");
scanf("%d",&n);
printf("n faktorial=%d ",faktor(n));

getch();
}

No comments:

Post a Comment