---
title: "Pattern: PULCHOWK using unformatted output"
subject: "Computer Programming"
chapter: 4
key: "semester_1/computer_programming:pattern-pulchowk"
source: https://www.bctengineer.com/q/semester_1/computer_programming/pattern-pulchowk
site: BCT Engineering
---

# Pattern: PULCHOWK using unformatted output

Computer Programming · Chapter 4: Input and Output

- Asked in: 2070 Chaitra, 7 marks
- Video: ['pulchowk' pattern using unformatted input output |C programming|](https://www.youtube.com/watch?v=jWCeFXV2qlk) — THE SPORTING TECHIE
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_1/computer_programming/pattern-pulchowk
- Whole chapter: https://www.bctengineer.com/md/semester_1/computer_programming/chapter-4

## Question

Write a C program to display following pattern using unformatted output statements:
```
P
Pu
PuL
PULC
PuLcH
PULCHO
puLcHoW
PULCHOWK
```

## Short answer

Store the exact row strings {"P","Pu","PuL","PULC","PuLcH","PULCHO","puLcHoW","PULCHOWK"} in a pointer array. For each row, use putchar in a loop to print each character, then a newline. The output matches the given mixed-case staircase pattern.

## Answer

The rows follow no single arithmetic rule for the upper/lower case, so they are stored as they are shown and printed character by character with `putchar()` (unformatted output). Row `i` has `i + 1` characters, so the pattern grows by one letter per row.

```c
#include <stdio.h>
int main(void)
{
    const char *row[8] = {"P", "Pu", "PuL", "PULC", "PuLcH",
                          "PULCHO", "puLcHoW", "PULCHOWK"};
    int i, j;
    for (i = 0; i < 8; i++)
    {
        for (j = 0; row[i][j] != '\0'; j++)
            putchar(row[i][j]);
        putchar('\n');
    }
    return 0;
}
```
Output:
```text
P
Pu
PuL
PULC
PuLcH
PULCHO
puLcHoW
PULCHOWK
```

#### Explanation
- `row[8]` holds the eight lines of the pattern.
- The outer loop selects a row; the inner loop runs until the string terminator `'\0'` and prints each character using `putchar()`.
- `putchar('\n')` moves to the next line after each row.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Why are the rows stored in an array?
   A. There is no simple arithmetic rule for upper/lower case
   B. Strings cannot be printed otherwise
   C. putchar needs arrays
   D. To save memory
   Answer: A. The case pattern is irregular so rows are stored as shown. (Key point: Why stored)

2. How many characters does row i (from 0) have?
   A. i
   B. i + 1
   C. i + 2
   D. 8
   Answer: B. The pattern grows by one letter per row. (Key point: Row length)

3. The inner loop ends when:
   A. j reaches 8
   B. row[i][j] is '\0'
   C. putchar returns 0
   D. i is 8
   Answer: B. It stops at the string terminator. (Key point: Inner loop end)

4. What moves to next line after each row?
   A. putchar('\n')
   B. putchar('\t')
   C. continue
   D. puts
   Answer: A. putchar('\n') ends the row. (Key point: Newline)

## Related in Computer Programming

- [Pattern N, eee, PPPPP using unformatted I/O](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Apattern-n-e-p-a-l) — Computer Programming, chapter 4
- [Output of printf statements](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aprintf-output-a-b) — Computer Programming, chapter 4
- [Pattern: shrinking "Programming"](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Apattern-programming-shrinking) — Computer Programming, chapter 4
- [Formatted and unformatted I/O in FORTRAN](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Afortran-formatted-unformatted-io) — Computer Programming, chapter 11
- [Output of arithmetic expression program](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aoutput-expression-xyz) — Computer Programming, chapter 3
- [Formatted vs unformatted I/O](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aformatted-vs-unformatted-io) — Computer Programming, chapter 4, asked 4×

## Related in other subjects

- [Pyramid pattern output program](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Apyramid-program) — Object Oriented Programming, chapter 8
- [Assembler statements and directives](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Aassembly-directives) — Microprocessor, chapter 3, asked 4×
- [Display 0 to 9 on seven segment](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3A8051-seven-segment-0-9) — Embedded System, chapter 9, asked 2×
- [Display N characters using default arguments](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3An-chars-default-args-program) — Object Oriented Programming, chapter 3
