{"id":"196bf2f9-bed2-4ffb-a26d-1fa7150f7751","name":"Print Fibonacci Numbers Till N","description":"1. You've to print first n fibonacci numbers.\r\n2. Take as input \"n\", the count of fibonacci numbers to print.\r\n3. Print first n fibonacci numbers.","inputFormat":"n","outputFormat":"0\r\n1\r\n1\r\n2\r\n3\r\n5\r\n8\r\n.. first n fibonaccis","constraints":"1 &lt;= n &lt; 40","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\r\n\r\nint main(int argc, char **argv)\r\n{\r\n int n;\r\n cin >> n;\r\n \r\n //write your code here\r\n \r\n}"},"java":{"code":"import java.util.*;\r\n \r\n public class Main{\r\n \r\n public static void main(String[] args) {\r\n // write your code here\r\n }\r\n }"},"python":{"code":"a=0\nb=1\nn=int(input())\n#write your code here"}},"points":10,"difficulty":"easy","sampleInput":"10","sampleOutput":"0\r\n1\r\n1\r\n2\r\n3\r\n5\r\n8\r\n13\r\n21\r\n34","questionVideo":"https://www.youtube.com/embed/JbLEpRy_vTk","hints":[],"associated":[{"id":"172d136f-4050-453d-8741-d3271fe4c9ad","name":"What 11th fibonacci number?","slug":"what-11th-fibonacci-number","type":4},{"id":"29a288ef-aa12-4610-a029-0d18cf3d9fa1","name":"What is the formula to calculate nth fibonacci number?","slug":"what-is-the-formula-to-calculate-nth-fibonacci-number","type":4},{"id":"94cd62a9-9bff-48e3-879c-a22744f8452d","name":"First 11 numbers of a fibonacci sequence are :","slug":"first-11-numbers-of-a-fibonacci-sequence-are","type":4},{"id":"d8163099-cb2d-4116-bb08-6ba7018f1668","name":"What is the value of f(0)?","slug":"what-is-the-value-of-f-0","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"72157774-7fd0-4b8e-88dc-037800acd626","name":"Getting Started","slug":"getting-started-9996","type":0},{"id":"7e52de98-8bba-492f-bbd1-e510e80ec653","name":"Print Fibonacci Numbers Till N","slug":"print-fibonacci-numbers-till-n","type":1}],"next":{"id":"9d392adf-2158-44d9-a7a8-0f9da9bc59c6","name":"Print Fibonacci Numbers Till N","type":3,"slug":"print-fibonacci-numbers-till-n"},"prev":{"id":"f27238c2-627f-496e-a8d6-4658efcb423f","name":"Primes Till N","type":3,"slug":"primes-till-n"}}}

Print Fibonacci Numbers Till N

1. You've to print first n fibonacci numbers. 2. Take as input "n", the count of fibonacci numbers to print. 3. Print first n fibonacci numbers.

{"id":"196bf2f9-bed2-4ffb-a26d-1fa7150f7751","name":"Print Fibonacci Numbers Till N","description":"1. You've to print first n fibonacci numbers.\r\n2. Take as input \"n\", the count of fibonacci numbers to print.\r\n3. Print first n fibonacci numbers.","inputFormat":"n","outputFormat":"0\r\n1\r\n1\r\n2\r\n3\r\n5\r\n8\r\n.. first n fibonaccis","constraints":"1 &lt;= n &lt; 40","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\r\n\r\nint main(int argc, char **argv)\r\n{\r\n int n;\r\n cin >> n;\r\n \r\n //write your code here\r\n \r\n}"},"java":{"code":"import java.util.*;\r\n \r\n public class Main{\r\n \r\n public static void main(String[] args) {\r\n // write your code here\r\n }\r\n }"},"python":{"code":"a=0\nb=1\nn=int(input())\n#write your code here"}},"points":10,"difficulty":"easy","sampleInput":"10","sampleOutput":"0\r\n1\r\n1\r\n2\r\n3\r\n5\r\n8\r\n13\r\n21\r\n34","questionVideo":"https://www.youtube.com/embed/JbLEpRy_vTk","hints":[],"associated":[{"id":"172d136f-4050-453d-8741-d3271fe4c9ad","name":"What 11th fibonacci number?","slug":"what-11th-fibonacci-number","type":4},{"id":"29a288ef-aa12-4610-a029-0d18cf3d9fa1","name":"What is the formula to calculate nth fibonacci number?","slug":"what-is-the-formula-to-calculate-nth-fibonacci-number","type":4},{"id":"94cd62a9-9bff-48e3-879c-a22744f8452d","name":"First 11 numbers of a fibonacci sequence are :","slug":"first-11-numbers-of-a-fibonacci-sequence-are","type":4},{"id":"d8163099-cb2d-4116-bb08-6ba7018f1668","name":"What is the value of f(0)?","slug":"what-is-the-value-of-f-0","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"72157774-7fd0-4b8e-88dc-037800acd626","name":"Getting Started","slug":"getting-started-9996","type":0},{"id":"7e52de98-8bba-492f-bbd1-e510e80ec653","name":"Print Fibonacci Numbers Till N","slug":"print-fibonacci-numbers-till-n","type":1}],"next":{"id":"9d392adf-2158-44d9-a7a8-0f9da9bc59c6","name":"Print Fibonacci Numbers Till N","type":3,"slug":"print-fibonacci-numbers-till-n"},"prev":{"id":"f27238c2-627f-496e-a8d6-4658efcb423f","name":"Primes Till N","type":3,"slug":"primes-till-n"}}}
plane

Editor


Loading...

Print Fibonacci Numbers Till N

easy

1. You've to print first n fibonacci numbers. 2. Take as input "n", the count of fibonacci numbers to print. 3. Print first n fibonacci numbers.

Constraints

1 <= n < 40

Format

Input

n

Output

0 1 1 2 3 5 8 .. first n fibonaccis

Example

Sample Input

10

Sample Output

0 1 1 2 3 5 8 13 21 34

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode