`{"id":"40ed4387-ad81-4fa1-9f21-a8a290b381d1","name":"Pattern 17","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/pat171.JPG\" alt=\"pat171\">","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\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":"*\t\r\n\t\t*\t*\t\r\n*\t*\t*\t*\t*\t\r\n\t\t*\t*\t\r\n\t\t*","questionVideo":"https://www.youtube.com/embed/kmqISkLQlMI","hints":[],"associated":[{"id":"5f105f1c-b178-4a72-a9e9-da9a588d4285","name":"(Pattern 17) What are the number of spaces in the given pattern except middle row ?","slug":"pattern-17-what-are-the-number-of-spaces-in-the-given-pattern-except-middle-row","type":4},{"id":"71af6273-e234-47e5-9fcb-3352c766471a","name":"(Pattern 17) Will the pattern give 10/10 marks if we don't add \"/t\" while printing the stars ?","slug":"pattern-17-will-the-pattern-give-10-10-marks-if-we-don-t-add-t-while-printing-the-stars","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":"ed16348a-5624-40f3-a18e-5d9d891f2e28","name":"Pattern 17","slug":"pattern-17","type":1}],"next":{"id":"3b1e1e5e-f3d2-4d93-b3d8-8ff86a1b943a","name":"Pattern 17","type":3,"slug":"pattern-17"},"prev":{"id":"5baad350-f0d0-4898-a5e9-d2538d151fdd","name":"PATTERN 16","type":3,"slug":"pattern-16"}}}`

# Pattern 17

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

`{"id":"40ed4387-ad81-4fa1-9f21-a8a290b381d1","name":"Pattern 17","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/pat171.JPG\" alt=\"pat171\">","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\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":"*\t\r\n\t\t*\t*\t\r\n*\t*\t*\t*\t*\t\r\n\t\t*\t*\t\r\n\t\t*","questionVideo":"https://www.youtube.com/embed/kmqISkLQlMI","hints":[],"associated":[{"id":"5f105f1c-b178-4a72-a9e9-da9a588d4285","name":"(Pattern 17) What are the number of spaces in the given pattern except middle row ?","slug":"pattern-17-what-are-the-number-of-spaces-in-the-given-pattern-except-middle-row","type":4},{"id":"71af6273-e234-47e5-9fcb-3352c766471a","name":"(Pattern 17) Will the pattern give 10/10 marks if we don't add \"/t\" while printing the stars ?","slug":"pattern-17-will-the-pattern-give-10-10-marks-if-we-don-t-add-t-while-printing-the-stars","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":"ed16348a-5624-40f3-a18e-5d9d891f2e28","name":"Pattern 17","slug":"pattern-17","type":1}],"next":{"id":"3b1e1e5e-f3d2-4d93-b3d8-8ff86a1b943a","name":"Pattern 17","type":3,"slug":"pattern-17"},"prev":{"id":"5baad350-f0d0-4898-a5e9-d2538d151fdd","name":"PATTERN 16","type":3,"slug":"pattern-16"}}}`

Editor

# Pattern 17

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