menu
QAmmunity.org
Login
Register
My account
Edit my Profile
Private messages
My favorites
Register
Ask a Question
Questions
Unanswered
Tags
Categories
Ask a Question
Create a process that will calculate the series 1 + x + x2 + x3 + x4 .......... + xn where x is a floating point number and n is a positive number. you process should be designed so exponentiation (or
asked
Jan 16, 2018
180k
views
2
votes
Create a process that will calculate the series 1 + x + x2 + x3 + x4 .......... + xn where x is a floating point number and n is a positive number. you process should be designed so exponentiation (or the pow function in c++) is not needed.
Mathematics
college
StrayPointer
asked
by
StrayPointer
8.3k
points
answer
comment
share this
share
0 Comments
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
1
Answer
5
votes
Assumptions
1. n is an integer.
2. Language is c++
double expr(double x, int n)
{
double sum = 0.0;
double power = 1.0; // Will have the value x^y where y ranges from 0 to n
int i;
for(i=0; i <= n; ++i) {
sum += power;
power *= x;
}
return sum;
}
KJAWolf
answered
Jan 21, 2018
by
KJAWolf
8.3k
points
ask related question
comment
share this
0 Comments
Please
log in
or
register
to add a comment.
Ask a Question
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.
9.5m
questions
12.2m
answers
Other Questions
What is .725 as a fraction
How do you estimate of 4 5/8 X 1/3
A bathtub is being filled with water. After 3 minutes 4/5 of the tub is full. Assuming the rate is constant, how much longer will it take to fill the tub?
Write words to match the expression. 24- ( 6+3)
A dealer sells a certain type of chair and a table for $40. He also sells the same sort of table and a desk for $83 or a chair and a desk for $77. Find the price of a chair, table, and of a desk.
Twitter
WhatsApp
Facebook
Reddit
LinkedIn
Email
Link Copied!
Copy
Search QAmmunity.org