954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Pls help me ..

Pls help me on this.
I really dont have an idea of solving this.
Here's the question ..

1. Write a c++ program that generates the following series: 0 -1 4 -9 16 -25 36 -49 64 -81 100

and also this one

2. write a program that generates the fibonacci series: 1 1 2 3 5 8 13 up to 50th term.

I was shocked when i saw this :-O It is not yet taking up. But pls. Help me. Thanks alot..

- Nell

nell16
Newbie Poster
2 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 
1. Write a c++ program that generates the following series: 0 -1 4 -9 16 -25 36 -49 64 -81 100

You simply need to print the squares of a number .
You can use square_of_num = num * num. Also every odd number has negative sign. It means if square_of_num < 0 multiply it with -1 .2. write a program that generates the fibonacci series: 1 1 2 3 5 8 13 up to 50th term.

Loop till 50th term. Inside loop print your fibonacci number. Your logic will be that next number is equal to sum of previous two numbers . So to start with , you will have to take 2 numbers both initialized to 1.

Atleast start coding. Doesn't matter if it is wrong. We are here to help. But you need to start coding on your own first :)

DJSAN10
Posting Whiz in Training
249 posts since Dec 2010
Reputation Points: 38
Solved Threads: 26
 

Alright first things first... I see this is your first post... so

We are NOT going to give you the entire program, then you learn nothing, trying and getting some code going and asking for help with syntax, errors or middle snippets we will do any time

Ok so first problem, identify the sequence... what us different between character 1, character 2, and character 3... if you find the difference write a loop that takes a digit, adds that digit until you meet the top value (100)

The same goes for problem 2 but it is just the fibonaci seq, check google

Eagletalon
Junior Poster
113 posts since Mar 2011
Reputation Points: 47
Solved Threads: 13
 

1. Write a c++ program that generates the following series: 0 -1 4 -9 16 -25 36 -49 64 -81 100

and also this one - Nell

Break it into two series
0 4 16 36 64 100 (square of even numbers starting from zero)
-1 -9 -25 -49 -81 (negative of square of odd numbers)
Mix both and you get the result2. write a program that generates the fibonacci series: 1 1 2 3 5 8 13 up to 50th term.
- Nell
you need two variables, say i and j. Initially it looks like this
i = 1;
j = 1;
1. Add both and keep the sum in a variable.
2. copy j to i
3. copy sum to j and repeat the process

subith86
Junior Poster
124 posts since Mar 2011
Reputation Points: 30
Solved Threads: 14
 

Break it into two series 0 4 16 36 64 100 (square of even numbers starting from zero) -1 -9 -25 -49 -81 (negative of square of odd numbers) Mix both and you get the result

you need two variables, say i and j. Initially it looks like this i = 1; j = 1; 1. Add both and keep the sum in a variable. 2. copy j to i 3. copy sum to j and repeat the process


Thanks for all the help. Im gonna try it. Ill post again and please check if its right. Thank you so much :D

nell16
Newbie Poster
2 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 


for 0 -1 4 -9 16 -25 36 -49 64 -81 100

use number*number*(-1 raised to the power number)

Ali_2101
Newbie Poster
16 posts since Feb 2012
Reputation Points: 4
Solved Threads: 3
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: