السلام عليكــم ورحمـة الله وبركاتــه
هذا السؤال
Write a program that computes and print the value of ex by using the formula:
ex = 1 + x/1! + x2/2! + x3/3! +….....+ xn/n! [Hint: use nested For loop]
sum المشكله دائما يطلع 1
وهذا الكود
#include<iostream>
using namespace std;
int main()
{
int fac=1,sum=1,pow=1;
int num,n;
cout<<"num";
cin>>num;
cout<<"n";
cin>>n;
for(int i=1;i>=n;i++)
{
for(int j=i;i>=1;j--)
{
fac=fac*j;
}
for(int y=1;y>=1;y++)
{
pow=pow*num;
}
sum=sum+pow/fac;
}
cout<<"sum"<<sum<<endl;
system("pause");
return 0;
}
