`{"id":"df44d1ea-030b-4acc-931f-3dddfcced742","name":"Pattern 20","description":"1. You are given a number n.\r\n2. 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/pat201.JPG\" alt=\"pat201\">","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 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())"}},"points":10,"difficulty":"easy","sampleInput":"5","sampleOutput":"*\t\t\t\t*\t\r\n*\t\t\t\t*\t\r\n*\t\t*\t\t*\t\r\n*\t*\t\t*\t*\t\r\n*\t\t\t\t*","questionVideo":"https://www.youtube.com/embed/JRjdGPn2Qz0","hints":[],"associated":[{"id":"0f1eb8f9-84e2-4ea8-8a99-9ccc0faec5f8","name":"(Pattern 20) Which statement shifts the sentence into next line?","slug":"pattern-20-which-statement-shifts-the-sentence-into-next-line","type":4},{"id":"9a8416ad-34b7-4f13-97f5-a75fe45482bb","name":"(Pattern 20)Can we use one while loop and one for Loop to print this pattern?","slug":"pattern-20-can-we-use-one-while-loop-and-one-for-loop-to-print-this-pattern","type":4},{"id":"cfde8e0b-855f-483e-ae38-bcd0d9952311","name":"(Pattern 20) What will be time complexity of the for Loop in this pattern?","slug":"pattern-20-what-will-be-time-complexity-of-the-for-loop-in-this-pattern","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":"621a2487-26ae-4397-945f-f30b36fb8106","name":"Pattern 20","slug":"pattern-20","type":1}],"next":{"id":"d7ac3fcf-e358-48e7-a212-5480513e6c6d","name":"Pattern 20","type":3,"slug":"pattern-20"},"prev":{"id":"cc604d50-f508-41f3-a947-23f0ab129490","name":"Pattern 19","type":3,"slug":"pattern-19"}}}`

# Pattern 20

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

`{"id":"df44d1ea-030b-4acc-931f-3dddfcced742","name":"Pattern 20","description":"1. You are given a number n.\r\n2. 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/pat201.JPG\" alt=\"pat201\">","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 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())"}},"points":10,"difficulty":"easy","sampleInput":"5","sampleOutput":"*\t\t\t\t*\t\r\n*\t\t\t\t*\t\r\n*\t\t*\t\t*\t\r\n*\t*\t\t*\t*\t\r\n*\t\t\t\t*","questionVideo":"https://www.youtube.com/embed/JRjdGPn2Qz0","hints":[],"associated":[{"id":"0f1eb8f9-84e2-4ea8-8a99-9ccc0faec5f8","name":"(Pattern 20) Which statement shifts the sentence into next line?","slug":"pattern-20-which-statement-shifts-the-sentence-into-next-line","type":4},{"id":"9a8416ad-34b7-4f13-97f5-a75fe45482bb","name":"(Pattern 20)Can we use one while loop and one for Loop to print this pattern?","slug":"pattern-20-can-we-use-one-while-loop-and-one-for-loop-to-print-this-pattern","type":4},{"id":"cfde8e0b-855f-483e-ae38-bcd0d9952311","name":"(Pattern 20) What will be time complexity of the for Loop in this pattern?","slug":"pattern-20-what-will-be-time-complexity-of-the-for-loop-in-this-pattern","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":"621a2487-26ae-4397-945f-f30b36fb8106","name":"Pattern 20","slug":"pattern-20","type":1}],"next":{"id":"d7ac3fcf-e358-48e7-a212-5480513e6c6d","name":"Pattern 20","type":3,"slug":"pattern-20"},"prev":{"id":"cc604d50-f508-41f3-a947-23f0ab129490","name":"Pattern 19","type":3,"slug":"pattern-19"}}}`

Editor

# Pattern 20

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;}5`

### 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