TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
harish reddy
NA
162
33.5k
Program output for loop
Dec 17 2017 11:01 PM
//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.
Reply
Answers (
5
)
wcf service not binding in controller
Rss News Feed using Asp.net using C#