{"id":"8bce74eb-c9d1-417f-a095-e35f4812e558","name":"Pattern 12","description":"1. You are given a number n.\r\n2. You've to create a pattern as shown in output format.","inputFormat":"A number n","outputFormat":"<img src=\"http://pepcoding.com/resources/ojquestionresource/images/pat121.JPG\" alt=\"pat121\">","constraints":"1 &lt;= n &lt;= 5","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\r\n\r\nint main(int argc, char **argv){\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\npublic class Main {\r\n\r\n public static void main(String[] args) {\r\n Scanner scn = new Scanner(System.in);\r\n\r\n // write ur code here\r\n\r\n }\r\n}"},"python":{"code":"n = int(input())\n\n# write your code here"}},"points":10,"difficulty":"easy","sampleInput":"5","sampleOutput":"0\t\r\n1\t1\t\r\n2\t3\t5\t\r\n8\t13\t21\t34\t\r\n55\t89\t144\t233\t377","questionVideo":"https://www.youtube.com/embed/W5jFT6sjpyU","hints":[],"associated":[{"id":"83983f59-a4ee-4ea3-bd0f-47bb9463efbd","name":"which one is the fibonacci sequence (pattern 12)","slug":"which-one-is-the-fibonacci-sequence-pattern-12","type":4},{"id":"f0d9c182-5739-4da8-8ad1-acaa009fdc22","name":"What is the order of printing the desired pattern (pattern 12)","slug":"what-is-the-order-of-printing-the-desired-pattern-pattern-12","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":"ca241a91-e685-4c63-9d83-892cf12c5576","name":"Patterns","slug":"patterns-9997","type":0},{"id":"e98c3507-68c3-4d8a-9d35-978fb935cf13","name":"Pattern 12","slug":"pattern-12","type":1}],"next":{"id":"0ed909f0-3c63-4a93-823e-99526fed93fc","name":"pattern 12","type":3,"slug":"pattern-12"},"prev":{"id":"90a1ca86-436f-4d55-befe-126b006f09c4","name":"Pattern 11","type":3,"slug":"pattern-11"}}}

Pattern 12

1. You are given a number n. 2. You've to create a pattern as shown in output format.

{"id":"8bce74eb-c9d1-417f-a095-e35f4812e558","name":"Pattern 12","description":"1. You are given a number n.\r\n2. You've to create a pattern as shown in output format.","inputFormat":"A number n","outputFormat":"<img src=\"http://pepcoding.com/resources/ojquestionresource/images/pat121.JPG\" alt=\"pat121\">","constraints":"1 &lt;= n &lt;= 5","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\r\n\r\nint main(int argc, char **argv){\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\npublic class Main {\r\n\r\n public static void main(String[] args) {\r\n Scanner scn = new Scanner(System.in);\r\n\r\n // write ur code here\r\n\r\n }\r\n}"},"python":{"code":"n = int(input())\n\n# write your code here"}},"points":10,"difficulty":"easy","sampleInput":"5","sampleOutput":"0\t\r\n1\t1\t\r\n2\t3\t5\t\r\n8\t13\t21\t34\t\r\n55\t89\t144\t233\t377","questionVideo":"https://www.youtube.com/embed/W5jFT6sjpyU","hints":[],"associated":[{"id":"83983f59-a4ee-4ea3-bd0f-47bb9463efbd","name":"which one is the fibonacci sequence (pattern 12)","slug":"which-one-is-the-fibonacci-sequence-pattern-12","type":4},{"id":"f0d9c182-5739-4da8-8ad1-acaa009fdc22","name":"What is the order of printing the desired pattern (pattern 12)","slug":"what-is-the-order-of-printing-the-desired-pattern-pattern-12","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":"ca241a91-e685-4c63-9d83-892cf12c5576","name":"Patterns","slug":"patterns-9997","type":0},{"id":"e98c3507-68c3-4d8a-9d35-978fb935cf13","name":"Pattern 12","slug":"pattern-12","type":1}],"next":{"id":"0ed909f0-3c63-4a93-823e-99526fed93fc","name":"pattern 12","type":3,"slug":"pattern-12"},"prev":{"id":"90a1ca86-436f-4d55-befe-126b006f09c4","name":"Pattern 11","type":3,"slug":"pattern-11"}}}
plane

Editor


Loading...

Pattern 12

easy

1. You are given a number n. 2. You've to create a pattern as shown in output format.

Constraints

1 <= n <= 5

Format

Input

A number n

Output

pat121

Example

Sample Input

5

Sample Output

0 1 1 2 3 5 8 13 21 34 55 89 144 233 377

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode