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
Code for Easily Using Hash Table?
write a program to perform generic sort in arrays?
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++
Write a simple encryption program using string function which apply the substitution method.
Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).
can you please write a program for deadlock that can detect deadlock and to prevent deadlock.
write a program that reads a series of strings and prints only those strings begging with letter "b"
i don't know about working of nested for loop can any one help me
write a function that allocates memory for a single data type passed as a parameter.the function uses the new operator and return a pointer to the allocated memory.the function must catch and handle any exception during allocation
how to take time as input in the format (12:02:13) from user so that controls remains between these columns?
How to Split Strings with Regex in Managed C++ Applications?
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
write a program using 2 D that searches a number and display the number of items 12 inputs values input 15,20, 13, 30, 38, 40,16, 18, 20 ,18 ,20 enter no. to search : 20
Write a (n) algorithm that sorts n distinct integers, ranging in size between 1 and kn inclusive, where k is a constant positive integer. (Hint: Use a kn-element array.)
write a program that reverses the input number of n.Formulate an equation to come up with the answer.