Challenge 3: Printing Pyramid

Test your understanding of loops by printing a half pyramid for a given number of rows in this lesson.

Problem statement

Write code which prints half a pyramid of the alphabet a.

  • The code takes an integer variable $rows as input and prints the pyramid with that number of rows displaying a.

Hint: Use for loops to implement the solution.

Input

An integer.

Output

Print the character a on the console.

Sample input

$rows is equal to 5.

Sample output

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy