Study guides

☆

Q: Write a program to print the Fibonacci series 0 1 1 2 3 5 8-------20?

Write your answer...

Submit

Still have questions?

Related questions

Just generate the Fibonacci numbers one by one, and print each number's last digit ie number%10.

Is this a homework question?

write a shell script to print thi format***************

Set two variables "a" and "b" to the starting number of the Fibonacci series, for example, 1 and 1. Then, repeatedly (i.e., in a loop) set: sum = a + b; b = a; a = sum; ... and print the sum (or equivalently, variable "a").

write a program to print the series 1/12+1/22+.........+1/n2 ?

The Fibonacci sequence uses recursion to derive answers. It is defined as: F0 = 0 F1 = 1 Fn = F(n - 1) + F(n -2) To have this sequence printed by a php script use the following: function fibonacci($n) { if($n 1) return 1; //F1 else return fibonacci($n - 1) + fibonacci($n - 2); //Fn } This recursive function will print out the Fibonacci number for the integer n. To make it print out all the numbers in a particular set add this to your script. for($i = 0; $i < 15; $i++) { echo fibonacci($i) . "<br />"; } So your final result would look like. <?php function fibonacci($n) { if($n 1) return 1; else return fibonacci($n - 1) + fibonacci($n - 2); } for($i = 0; $i < 15; $i++) { echo fibonacci($i) . "<br />"; } ?>

write a program to print A to Z on screen in c?

//WAP to print fibonacci series using do-while loop.? using System; class Fibonacci { public static void Main() { int a=1,b=1; int sum=0; Console.Write("Enter Limit:"); int n=Int32.Parse(Console.ReadLine()); Console.Write(a); Console.Write(b); do { sum=a+b; a=b; b=sum; Console.Write(sum); } while(sum<n); } } By-Vivek Kumar Keshari

Write a c program to print the 100 to 1 nos

echo 'print a pattern'

If you have the series stored in an array, you loop through the array and print each array element in turn. Another possibility is to print out the numbers in the series as you generate them. In that case, you may not need to store anything (depending on the series, of course).

CLS a = 0 b = 0 FOR i = 1 TO 10 IF a = 0 THEN f = 1 END IF PRINT f b = a a = f f = a + b NEXT i END from : Parth jani parthjani7@yahoo.com

Reference:cprogramming-bd.com/c_page2.aspx# divisible

#include<iostream> unsigned fib (unsigned term, unsigned a=0, unsigned b=1) { if (term<1) return a; return fib (--term, a+b, a); } int main() { std::cout << "Fibonacci (1000th term): " << fib (1000) << std::endl; }

I am not so sure about C++, but Python is somewhat similar. def awesome_function() number = input("The number you would like to use?") for i in range(number) print(i) Great question! ^^

#include<stdio.h> void main() {printf("Your name\n"); }

Private Sub Command1_Click() Dim x,g,n,i,sum as Integer n=Val(Text1.Text) x=0 y=1 Print x Print y for i=3 To n Sum = x + y Print Sum x = y y = Sum Next i End Sub

Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.

void main() { int n,old=0,curr=1,new=0; clrscr(); printf("enter the total number of terms up to which you want to print the Fibonacci series"); scanf("%d",&n); printf("%d",old); printf("\n%d",curr); for(i=1;i<=n;i++) { new=old+curr; old=curr; curr=new; printf("\n%d",new); } getch(); }

#include<iostream> using namespace std; int main() { cout << "Fibonacci sequence up to 100... int f1 = 0; int f2 = 1; cout << f1 << endl; while (f2<100) { cout << f2 << endl; int next = f1 + f2; f1 = f2; f2 = next; } }

type: PRINT "I like chocalate!"

10 print "That is not a question." 20 print "That is a command." 30 end

write a c program that prints out the multiplication table of 4 using function

write a c++ program to extract a portion of a character string and print extracted string

#include int main (void) { puts ("print"); return 0; }