Given an odd positive integer n print a rhombus of stars as in the example below
Example:
Input: n = 5 Output: * *** ***** *** * Explanation: There are n = 5 lines. Each line contains exactly n = 5 characters. 1st line contains two spaces, one '*' and two spaces. 2nd line contains one space, three '*' and one space. 3rd line contains five stars. 4th line contains one space, three '*' and one space. 5th line contains two spaces, one '*' and two spaces.Note: Be careful to add the necessary spaces at the end of every line!
Walkthroughs of the solution. Try the steps first, then watch to compare approaches.
Free plan: 30 tutor messages. Premium is unlimited.
Saved
Ctrl + Enter to check