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.4k
Program output c sharp
Dec 18 2017 3:08 AM
Write a program in C# Sharp to find the sum of the series [ x - x^3 + x^5 + ......] using for loop. I did till here...but not getting the ouput.
int x = int.Parse(Console.ReadLine());
int n = int.Parse(Console.ReadLine());
double sum = 0;
for (int i = 1; i <= n; i=i+2)
{
double result = Math.Pow(x, i);
sum = sum + result;
}
Console.WriteLine(sum);
Reply
Answers (
5
)
Http Server 503 Service unavailable
cannot implicitly convert type string[] to decimal[]