Menu
CoddyTech

Number Pattern

Part of the Fundamentals section of Coddy's C++ journey. Lesson 72 of 74.

challenge icon

Challenge

Easy

Each test case has one input - an odd whole number.
Your task is to print n - pyramid using *, here are some examples:

1 - pyramid

*

5 - pyramid

*
***
*****

7 - pyramid

*
***
*****
*******

Input

  • odd integer n from user
  • 1 <= n < 1000

Tips

  • Try starting from the small triangles
  • Check the hint if you are stuck ;)

n represents the number of  * in the bottom row

Try it yourself

#include <iostream>

int main() {
    int n;
    std::cin >> n;
    // Write your code below
    
    return 0;
}

All lessons in Fundamentals

Practice on your own: Online C++ compiler