How can i create a program wit the following problem:

Input to numbers wherein the the next number is the sum of the previous two.

Example:
Input:
Enter first number: 1
Enter second number: 2
Output:
1 3 4 7 11 18 29 47 76 123...

Recommended Answers

All 2 Replies

Its not a place where u post your homework directly.... Still i am giving u a hint

loop
{
take three variable i,j,sum
i with certain value
j with certain value
sum = i + j
rest will be easy if u think a bit.
}

I do not understand your question. Is it correct?

Example:
Input:
Enter first number: 1
Enter second number: 2
Output:
1 3 4 7 11 18 29 47 76 123...

For these input Input:
Enter first number: 1
Enter second number: 2
The output will be....
1 2 3 5 8 13 21 34 ....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.