Display character '1' pattern based on row (nested for loop)

0
Output


Explanation of the Character Pattern Program

This program prints a simple character pattern using nested loops. Instead of printing increasing numbers or alphabets, it prints the same character '1' repeatedly in each row. The rows grow in size, forming a triangular pattern.

The character is defined once at the beginning, and the loops handle how many times it appears on each line. The program also uses getch() at the end, which is commonly used in Turbo C to pause the output screen.

What the Program Does

  • Takes the number of rows from the user.
  • Uses an outer loop to print each row.
  • The inner loop prints the same character ('1') multiple times depending on the row number.
  • Prints a growing triangular pattern of characters.
  • Uses getch() to pause the screen (Turbo C feature).

Example Input

Enter the number of row: 5

Example Output

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Summary: The program prints a triangular pattern where each row contains repeated instances of the character '1'. The nested loops make it easy to control the structure and growth of the pattern.

Tags

Post a Comment

0Comments

Post a Comment (0)