Click here to Skip to main content
16,004,574 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to form a loop for series 1,3,5,9,12,15,20,24,28,34,39,43....

EDIT (by Nelek): The OP answered below

I GOT THE ANSWER AND FORMED THE LOOP:

IT IS AS FOLLOWS:-

int n=1;
int k;
cout<<"1";
for(int i=2;i<100;i++)
{
cout<<k=n+i<<k=k+i<<k=k+i+2;
n=k;
}


and Mr christian tnx for giving me advice....
Posted
Updated 4-Jan-10 21:01pm
v3

I believe you'll find that this is called homework. That means you're supposed to work out how to do it yourself. By all means ask a specific question when you've tried to learn something by yourself and found you need a little help. Don't ask us to do it all for you. We know from bitter experience that if we help you, you will pass without learning anything, and you'll be asking us similar questions in the workplace.
 
Share this answer
 
I GOT THE ANSWER AND FORMED THE LOOP:

IT IS AS FOLLOWS:-

int n=1;
int k;
cout<<"1";
for(int i=2;i<100;i++)
{
cout<
 
Share this answer
 
v3
Your loop is Ok, that will print out the numbers of the serie, but just a last thing... with that you are going to print out something like:
1359121520....

So you just need to add the blank spaces and the comas to make it readable as a serie.
 
Share this answer
 
:confused::confused::confused::confused::confused:

And that means...??
 
Share this answer
 
v2
Mr neelak at least that u can do ,if u are aware of programming languages.Am i right,aren't i? :-\
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900