رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد
السلام عليكم
أتمنى من الاخوة الكرام مساعدتي لحل هذا السؤال
Write a C program to compute the value of the mathematical constant e to the power of x (ex) by using the infinite series:
ex = 1 + x/1! + x2/2! + x3/3! + x4/4! + …
Your program should include at least one function called compute_ex which receives any value of x as a paramter and returns the value of ex as a result. Your program should also NOT use the already predefined system function pow.
The computation should stop when the new term added ( term = Xn/n! where n=0,1,2,3,…) is less than 0.0001.
ملاحظة للسؤال: لا يوجد ضرورة لاستخدام فنكشن جاهز(Pow)
لأنه يوجد علاقة تربط البسط ببعضه في المتسلسلة والمقام أيضاً
مثال عن البسط:x^0+x^0*x+x^1*x+x^2*x+x^3*x
نضرب في كل مرة الناتج بx
والمقام نفس العلاقة
نضرب كل رقم بالرقم الذي يليه
مثال 1*2+2*3+3*4+4+5وهكذا
وجزاكم الله خيراً...
|