`{"id":"92c6d56a-a8b5-43ce-b496-a009fe4a5ff8","name":"Pattern 18","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/pat181.JPG\" alt=\"pat181\">","constraints":"1 &lt;= n &lt;= 10\r\n Also, n is odd.","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\r\nint main(int agrc, 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//write your code here"}},"points":10,"difficulty":"easy","sampleInput":"7","sampleOutput":"*\t*\t*\t*\t*\t*\t*\t\r\n\t*\t\t\t\t*\t\r\n\t\t*\t\t*\t\r\n\t\t\t*\t\r\n\t\t*\t*\t*\t\r\n\t*\t*\t*\t*\t*\t\r\n*\t*\t*\t*\t*\t*\t*","questionVideo":"https://www.youtube.com/embed/f91AwaEd2EQ","hints":[],"associated":[{"id":"94f0dde2-07f0-47ce-b67c-2f81ca842288","name":"(Pattern 18)In the upper pyramid, we want to print star in which column?","slug":"pattern-18-in-the-upper-pyramid-we-want-to-print-star-in-which-column","type":4},{"id":"bf49cb13-47ef-4c73-821f-28be5bbcc268","name":"(Pattern 18) Stars are decreasing and increasing by how much?","slug":"pattern-18-stars-are-decreasing-and-increasing-by-how-much","type":4},{"id":"df7cbd4c-028f-4e31-9e2c-55e820a81638","name":"(Pattern 18) How many rows you need to print?","slug":"pattern-18-how-many-rows-you-need-to-print","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":"11e1b097-987b-406e-9adf-4524a746a524","name":"Pattern 18","slug":"pattern-18","type":1}],"next":{"id":"740873be-00d7-48c5-8912-e3f98ca13ea3","name":"Pattern 18","type":3,"slug":"pattern-18"},"prev":{"id":"3b1e1e5e-f3d2-4d93-b3d8-8ff86a1b943a","name":"Pattern 17","type":3,"slug":"pattern-17"}}}`

# Pattern 18

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

`{"id":"92c6d56a-a8b5-43ce-b496-a009fe4a5ff8","name":"Pattern 18","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/pat181.JPG\" alt=\"pat181\">","constraints":"1 &lt;= n &lt;= 10\r\n Also, n is odd.","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\r\nint main(int agrc, 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//write your code here"}},"points":10,"difficulty":"easy","sampleInput":"7","sampleOutput":"*\t*\t*\t*\t*\t*\t*\t\r\n\t*\t\t\t\t*\t\r\n\t\t*\t\t*\t\r\n\t\t\t*\t\r\n\t\t*\t*\t*\t\r\n\t*\t*\t*\t*\t*\t\r\n*\t*\t*\t*\t*\t*\t*","questionVideo":"https://www.youtube.com/embed/f91AwaEd2EQ","hints":[],"associated":[{"id":"94f0dde2-07f0-47ce-b67c-2f81ca842288","name":"(Pattern 18)In the upper pyramid, we want to print star in which column?","slug":"pattern-18-in-the-upper-pyramid-we-want-to-print-star-in-which-column","type":4},{"id":"bf49cb13-47ef-4c73-821f-28be5bbcc268","name":"(Pattern 18) Stars are decreasing and increasing by how much?","slug":"pattern-18-stars-are-decreasing-and-increasing-by-how-much","type":4},{"id":"df7cbd4c-028f-4e31-9e2c-55e820a81638","name":"(Pattern 18) How many rows you need to print?","slug":"pattern-18-how-many-rows-you-need-to-print","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":"11e1b097-987b-406e-9adf-4524a746a524","name":"Pattern 18","slug":"pattern-18","type":1}],"next":{"id":"740873be-00d7-48c5-8912-e3f98ca13ea3","name":"Pattern 18","type":3,"slug":"pattern-18"},"prev":{"id":"3b1e1e5e-f3d2-4d93-b3d8-8ff86a1b943a","name":"Pattern 17","type":3,"slug":"pattern-17"}}}`

Editor

# Pattern 18

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 Also, n is odd.

A number n

## Example

Sample Input

`.css-23h8hz{color:inherit;font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;}7`

### Sample Output

```.css-3oaykw{color:var(--chakra-colors-active-primary);font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;font-family:Monospace;}* * * * * * * * * * * * * * * * * * * * * * * * * * *```

Question Video

Discussions

Show Discussion

Related Resources