الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مساعدة

مغلق
بدأه alr7al في 16 مايو 2003 · 4 رد · 528 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمة الله في الحقيقة لدي ثلاث اسئلة

باستخدام while

1.write a program that reads a nonnegative integer and computes and prints its factorial

2. write a program that estimates the value of the mathematical constant e by using the formula e=1+(1/1!)+1/(2!)........

3.write a program that computes the value of e^x bu using the formula

e^x=1+(x/1!)+x^2/(2!)........

الرجاء شرح طريقة عمل البرنامج وشكرا

#2

السلام عليكم

اين الاعضاء الكرام لماذا لم يرد احد على الموضوع

الرجاء المساعده :'(:'(:'(:'(:'(

مع السلامة

#3

a

اللهم انا نسألك علما نافعا ونعوذ بك من حماقة الجهلاء
#4
include 
#include 
const double eps=0.000001;

/*Problem 1*/
double fac( int n)
{
		if(n==1||n==0)
		return 1;
	else
		return n*fac(n-1);

}

/* Problem 2*/
double ex()
{
	int n=1;
	double sum=0.0;
	double elem=1;
	while(elem>eps)
	{
		elem=(double)n/fac(n);
		sum+=elem;
		n++;
	}
	return sum;
}
/*Problem  3*/
double ex_h_x(int x)
{

	int n=1;
	double sum=0.0;
	double elem=1;
	double x_h_n;
	while(elem>eps)
	{
		x_h_n=pow(x,n);
		elem=x_h_n/fac(n);

		sum+=elem;
		n++;
		//cout<<"n n:   "<	}
	return (sum+1.0);//the star element

}
int main()
{
	int n=5;

	double problem1=fac(n);
	double problem2=ex();
	double problem3=ex_h_x(n);

	cout<	cout<<"e="<	cout<<"e^"<	return 0;
}
اللهم انا نسألك علما نافعا ونعوذ بك من حماقة الجهلاء
#5

السلام عليكم

اشكرك اخي العزيز

هذا الموضوع مغلق.

مواضيع مشابهة