write a function -oriented program that generates the
Fibonacci, the current numbers of n(as input) and display
them (series). In Fibonacci, the current third number is the
sum of the previous number.
Answer Posted / karthik
#include<iostream.h>
int main()
{
int a=-1,b=1,c,n;
printf("Enter the length of series");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
c=a+b;
a=b;
b=c;
printf("%d",c);
}
return 0;
}
| Is This Answer Correct ? | 11 Yes | 2 No |
Post New Answer View All Answers
How can I Draw an ellipse in 3d space and color it by using graph3d?
how to take time as input in the format (12:02:13) from user so that controls remains between these columns?
Question 1: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. *This Should Be Done IN C++
find level of following tree (state, parent) " J,D I,D H,C E,B F,B G,C B,A D,A C,A A,& K,E L,E L,F M,F N,G O,H P,I P,H Q,I R,J S,K U,P T,L
Create a program to read two random data set in two files named data1.txt and data2.txt manifold contains integer numbers, whereas data2.txt file contains the float type numbers. Simpanlahmasing each into 2 pieces of data that is an array of type integer array and an array of type float, then calculate the average numbers in the second array.
Code for Easily Using Hash Table?
can you please write a program for deadlock that can detect deadlock and to prevent deadlock.
How to swap two ASCII numbers?
write a program that reverses the input number of n.Formulate an equation to come up with the answer.
Code for Two Classes for Doing Gzip in Memory?
i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.
write a program using virtual function to find the transposing of a square matrix?
Write a simple encryption program using string function which apply the substitution method.
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
write a program to calculate the amount of investment after a period n years if the principal investors was p and interest is calculated using compound interest,formular=a=p(1+r)^n