السلام عليكم
عندي واجب مو عارفة كيف ابدأ فيه
فكرة حله او طريقة حله موعارفة له
حد عنده اي فكرة اكون شاكرة جدا
ملاحظة:
انا مو طالبة حد يحل الواجب عني
انا اطلب يد العون والمساعدة في طريقة حله
السؤال هو:
Write a program, that computes and prints out the coefficients of Pascal’s triangle for the first n rows. Start by writing a recursive function, int C(m,n) that computes C(m,n) recursively. It should make use of the following formula: C(m,0) = 1 and C(m, m) = 1 for m >= 0. C(m,n) = C(m-1, n-1) + C(m-1, n) for m > n > 0. First, write your main function to test your C(m,n) function with several different values of m and n (remember to keep n <= m). Your program should be able to print out the Pascal triangle until first n rows, where n is being entered by the user.
ومثال لشاشة البرنامج
Enter number n: 3 [Enter] Result: 1 1 1 1 2 1 1 3 3 1 Enter number n: 4 [Enter] Result: 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
ومشكوريـــــــن
