code 24
تابعی ای که عددی از ورودی خوانده به کمک تابع بازگشتی فاکتوریل آن را محاسبه می کند.
(۴-۹)
:
#include <stdio.h> #include <conio.h> unsigned long fact(int) ; int main() { int m ; printf("\n enter a positive integer5 number:"); scanf("%d", &m); printf("\n number=%d, fact= %ld", m, fact(m)); getch(); return 0; } //********************** unsigned long fact(int x) { if(x != 0) return(x * fact(x - 1)) ; return 1 ; }
سلام خدا قوت خیلی ممنونم
عالی
عالی از آموزش هاتون