I have to write a programme using loop struture to calculate the following formula r=1/x+1/2x+1/3x+......+1/nx .


The user can input any interger for n and nonzero for x .

I have to write a programme using loop struture to calculate the following formula r=1/x+1/2x+1/3x+......+1/nx .


The user can input any interger for n and nonzero for x .

What part are you having problems with? Post what you have.

int n=0
double x=0;
int counter=0;

cout<<"please enter your integer ";
cin>>n;
cout<<'please enter your real number";
cin>>x;

counter=1;
while(counter<=n)
{


i need help after plzzz

In writing just one step of the formula, how can you relate the counter variable to what you see in the formula?

int n=0
double x=0;
int counter=0;

cout<<"please enter your integer ";
cin>>n;
cout<<'please enter your real number";
cin>>x;

counter=1;
while(counter<=n)
{


i need help after plzzz

If r is in your equation, r needs to be in your program. Any starting bracket (like your while loop) needs to have an ending bracket. What do you need in your while loop? You are adding a series of terms, so you are going to be creating a term inside of the while loop, then adding it to some larger sum. That sum variable needs to be initialized. Should it be initialized before, inside, or after the while loop? What should it be initialized to? What variable in your problem is the sum variable?

I have to write aprogramme using loop structure ot calculate the follow formula r=1/x+1/2x+1/3x+........1/nx where user can input any interger for n and any real number for x . PLease thxxx

I have to write aprogramme using loop structure ot calculate the follow formula r=1/x+1/2x+1/3x+........1/nx where user can input any interger for n and any real number for x . PLease thxxx

We are helping you. We are bringing up questions that you need to ask yourself in order to solve the problem. The answers to these questions will guide you in how to code it.

CAn you please code me the answer if you dont mind i really need it now thzzzzzzzz plzz

If we just gave you the answer, would you really be learning anything?

Look at the examples in the text, and any your instructor has provided. You will most likely find something that provides a starting point.

i have to give the programme back to my teacher in few mins and i am stuck with all my note so pleasee

>i have to give the programme back to my teacher in few mins
Too bad, so sad. We're not responsible for your laziness.

This article has been dead for over six months. Start a new discussion instead.