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
Implement a command console for changing settings on a particular object. The command console should allow you to enter a string and will return the response (very similar to a terminal session). The commands are as follows: SET propertyname=newvalue will change the target object’s member named “propertyname” to have a value equal to “newvalue”. If the input value is incompatible (i.e. an int being set to a string), print out an appropriate error message. GET propertyname will print out the current value of the target object’s member named “propertyname”. GET * will print out a list of all target object members and their current values. The system should be extensible for future commands and should accept an arbitrary object, such that another developer could insert another object into the system and rely on the command console to get and set the properties correctly.
3. Program to find the Sum of give series. a. (1)+(1+2)+(1+2+3)+(1+2+3+4)+……………………………….. b. 1/1+1/9+1/25+1/49+……………...
output for printf("printf");
Code for Easily Using Hash Table?
how to take time as input in the format (12:02:13) from user so that controls remains between these columns?
How can I Draw an ellipse in 3d space and color it by using graph3d?
Ask the user to input three positive integers M, N and q. Make the 2 dimensional array of integers with size MxN, where all the elements of I (I = 1,…,M) line will be members of geometrical progression with first element equal to the number of line (I) and denominator q.
Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).
write a program that reads a series of strings and prints only those strings begging with letter "b"
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
Write a C/C++ program that connects to a MySQL server and displays the global TIMEZONE.
write a function that reverse the elements of an array in place.The function must accept only one pointer value and return void.
How to Split Strings with Regex in Managed C++ Applications?
solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)
How to swap two ASCII numbers?