#include <stdio.h>
long int multiplyNumbers(int n);
int main(void){
int n;
printf("Enter a positive integer: ");
scanf("%d", &n);
printf("Factorial of %d = %ld\n", n, multiplyNumbers(n));
return 0;
}
long int multiplyNumbers(int n){
if(n >= 1)
return n*multiplyNumbers(n-1);
else
return 1;
}
정수 입력 : 6
6 = 720
댓글 없음:
댓글 쓰기