Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
5
Reply
Program output for loop
harish reddy
Dec 17 2017 11:01 PM
218
Reply
//Write a program in C# Sharp to display the sum of the series [ 1+x+x^2/2!+x^3/3!+....]
int x = int.Parse(Console.ReadLine());
int n = int.Parse(Console.ReadLine());
int sum = 1 + x;
int top;
for (int i = 2; i <= n; i++)
{
top = x ^ i;
sum = sum + top;
}
Console.WriteLine(sum);
Not able to proceed further. pls help. Also can we use X^i for powering a number?
My main doubt is how can i put factorial also in the above loop...
I see many answers in google for the above program. but not able to understand. can someone help with using the above code i did.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
5
)
Next Recommended Forum
wcf service not binding in controller
Rss News Feed using Asp.net using C#