{"id":"8c066f83-6143-40d5-a969-5b046f58a168","name":"Pattern 16","description":"1. You are given a number n.\r\n 2. You've to write code to print the pattern given in output format below","inputFormat":"A number n","outputFormat":"<img src=\"http://pepcoding.com/resources/ojquestionresource/images/pat161.JPG\" alt=\"pat161\">","constraints":"1 &lt;= n &lt;= 10","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\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\npublic 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":"7","sampleOutput":"1\t\t\t\t\t\t\t\t\t\t\t\t1\t\r\n1\t2\t\t\t\t\t\t\t\t\t\t2\t1\t\r\n1\t2\t3\t\t\t\t\t\t\t\t3\t2\t1\t\r\n1\t2\t3\t4\t\t\t\t\t\t4\t3\t2\t1\t\r\n1\t2\t3\t4\t5\t\t\t\t5\t4\t3\t2\t1\t\r\n1\t2\t3\t4\t5\t6\t\t6\t5\t4\t3\t2\t1\t\r\n1\t2\t3\t4\t5\t6\t7\t6\t5\t4\t3\t2\t1","questionVideo":"https://www.youtube.com/embed/qtWOvVRMHuM","hints":[],"associated":[{"id":"5de1c704-68ed-4caf-a093-ab0f1d8be6c5","name":"(Pattern 16) Is there any need to treat last row as special?","slug":"pattern-16-is-there-any-need-to-treat-last-row-as-special","type":4},{"id":"7739080e-f055-467f-9e2e-08eb4160f57a","name":"(Pattern 16) What is the correct place to change the line?","slug":"pattern-16-what-is-the-correct-place-to-change-the-line","type":4},{"id":"9edd2d78-e1ac-458a-bfa2-2fd20c27205a","name":"(Pattern 16) What is the relation between total no. of rows(\"n\") and initial no. of spaces(i.e. no. of spaces in first row) where spaces are decreasing by 2?","slug":"pattern-16-what-is-the-relation-between-total-no-of-rows-n-and-initial-no-of-spaces-i-e-no-of-spaces-in-first-row-where-spaces-are-decreasing-by-2","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":"4231a5a9-c83d-449a-a007-d921c0520ea3","name":"Pattern 16","slug":"pattern-16","type":1}],"next":{"id":"5baad350-f0d0-4898-a5e9-d2538d151fdd","name":"PATTERN 16","type":3,"slug":"pattern-16"},"prev":{"id":"5aa3c02e-735d-4b8e-88df-18dc0a334988","name":"Pattern 15","type":3,"slug":"pattern-15"}}}

Pattern 16

1. You are given a number n. 2. You've to write code to print the pattern given in output format below

{"id":"8c066f83-6143-40d5-a969-5b046f58a168","name":"Pattern 16","description":"1. You are given a number n.\r\n 2. You've to write code to print the pattern given in output format below","inputFormat":"A number n","outputFormat":"<img src=\"http://pepcoding.com/resources/ojquestionresource/images/pat161.JPG\" alt=\"pat161\">","constraints":"1 &lt;= n &lt;= 10","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\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\npublic 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":"7","sampleOutput":"1\t\t\t\t\t\t\t\t\t\t\t\t1\t\r\n1\t2\t\t\t\t\t\t\t\t\t\t2\t1\t\r\n1\t2\t3\t\t\t\t\t\t\t\t3\t2\t1\t\r\n1\t2\t3\t4\t\t\t\t\t\t4\t3\t2\t1\t\r\n1\t2\t3\t4\t5\t\t\t\t5\t4\t3\t2\t1\t\r\n1\t2\t3\t4\t5\t6\t\t6\t5\t4\t3\t2\t1\t\r\n1\t2\t3\t4\t5\t6\t7\t6\t5\t4\t3\t2\t1","questionVideo":"https://www.youtube.com/embed/qtWOvVRMHuM","hints":[],"associated":[{"id":"5de1c704-68ed-4caf-a093-ab0f1d8be6c5","name":"(Pattern 16) Is there any need to treat last row as special?","slug":"pattern-16-is-there-any-need-to-treat-last-row-as-special","type":4},{"id":"7739080e-f055-467f-9e2e-08eb4160f57a","name":"(Pattern 16) What is the correct place to change the line?","slug":"pattern-16-what-is-the-correct-place-to-change-the-line","type":4},{"id":"9edd2d78-e1ac-458a-bfa2-2fd20c27205a","name":"(Pattern 16) What is the relation between total no. of rows(\"n\") and initial no. of spaces(i.e. no. of spaces in first row) where spaces are decreasing by 2?","slug":"pattern-16-what-is-the-relation-between-total-no-of-rows-n-and-initial-no-of-spaces-i-e-no-of-spaces-in-first-row-where-spaces-are-decreasing-by-2","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":"4231a5a9-c83d-449a-a007-d921c0520ea3","name":"Pattern 16","slug":"pattern-16","type":1}],"next":{"id":"5baad350-f0d0-4898-a5e9-d2538d151fdd","name":"PATTERN 16","type":3,"slug":"pattern-16"},"prev":{"id":"5aa3c02e-735d-4b8e-88df-18dc0a334988","name":"Pattern 15","type":3,"slug":"pattern-15"}}}
plane

Editor


Loading...

Pattern 16

easy

1. You are given a number n. 2. You've to write code to print the pattern given in output format below

Constraints

1 <= n <= 10

Format

Input

A number n

Output

pat161

Example

Sample Input

7

Sample Output

1 1 1 2 2 1 1 2 3 3 2 1 1 2 3 4 4 3 2 1 1 2 3 4 5 5 4 3 2 1 1 2 3 4 5 6 6 5 4 3 2 1 1 2 3 4 5 6 7 6 5 4 3 2 1

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode