Sunday, July 19, 2026

Printing Letters in a Column| Alphabet Patterns in C

Moving from printing characters horizontally to vertically is a key step in mastering grid-based patterns in C. In this tutorial, we will learn how to print letters in a single column, which introduces the essential concept of the newline character \n.

What You Will Learn

This post will guide you through creating a C program that prints a series of letters vertically. You will learn how to transition from horizontal sequence printing to vertical column printing by controlling line breaks.

Prerequisites:

  • Understanding of for loops in C.

  • Familiarity with the printf function.

Final Output:

If we choose to print 5 letters in a column, the output will look like this:


A
B
C
D
E

Deconstructing the Pattern: The Logic

1. The Visual Representation

Unlike the row pattern where characters appear side-by-side, a column pattern requires us to move the cursor to a new line after printing each character:

  • Row 1: 'A' + newline

  • Row 2: 'B' + newline

  • Row 3: 'C' + newline

  • Row 4: 'D' + newline

  • Row 5: 'E' + newline

2. Problem Statement

The goal is to output a sequence of letters, but instead of appending them to the current line, we move to the next line for every iteration of our loop.

3. Pattern Analysis & Logic

  • Identifying the Logic: We use the same ASCII-based incrementing logic ('A' + i) as the row pattern, but we append a \n (newline character) to the printf statement.

  • Algorithm:

    1. Start a for loop from $i = 0$ to $n-1$.

    2. Calculate the character to print as ('A' + i).

    3. Print the character followed by a newline: printf("%c\n", ...);.

The Code Implementation


#include <stdio.h>

int main() {
    int n = 5; // Total number of letters to print in the column

    // Loop to print A, B, C, D, E vertically
    for (int i = 0; i < n; i++) {
        // Printing the character followed by a newline
        printf("%c\n", 'A' + i);
    }

    return 0;
}

Explanation:

  • for (int i = 0; i < n; i++): This loop handles the iteration through the sequence.

  • printf("%c\n", 'A' + i);: The inclusion of \n inside the printf function is the critical step; it forces the program to move the output cursor to a new line after each character is printed.

Sample Output and Analysis

User Input:

  • The code is set for n = 5.

Program Output:


A
B
C
D
E

Output Analysis: The loop runs 5 times. In each iteration, the program prints the current character and immediately advances to the next line, creating a vertical column.

Common Mistakes and Troubleshooting

  • Forgetting the Newline: If you omit the \n, all characters will print on one line (ABCDE), effectively reverting the code to the horizontal row pattern.

  • Incorrect Loop Range: Ensure your loop range matches the number of letters you wish to display; otherwise, you may print symbols beyond the standard English alphabet (e.g., if $n > 26$).

Complexity Analysis

  • Time Complexity: O(n), as the loop iterates n times.

  • Space Complexity: O(1), as the logic uses a constant amount of extra space.

Conclusion

By simply adding a newline character, you have unlocked the ability to control vertical output. This technique is fundamental for creating structures like pyramids and triangles.



For all Pattern Programs list click here

…till the next post, bye-bye & take care


Beyond the Hype: 4 Reasons Why Your Brain Still Outsmarts AI

Beyond the Hype: 4 Reasons Why Your Brain Still Outsmarts AI

Imagine a simple math problem: Yesterday, you bought five apples at the grocery store. Today, you bought ten more, but five of them turned out to be rotten. How many apples have you bought in total?

For a human, the answer is an effortless 15. The condition of the apples is a distracting detail, irrelevant to the total count. Yet, for years, the most sophisticated Large Language Models (LLMs) would confidently answer "10." They aren’t "thinking" in any biological sense; they are calculating the statistical probability of the next word in a sequence. Because most math textbooks involve subtracting "rotten" or "broken" items from a total, the AI identifies a pattern and defaults to subtraction, prioritizing a correlation over the actual logic of the prompt.

While developers often patch these specific "glitches," prominent AI researchers like Yann LeCun argue that the underlying issue remains untouched. LeCun suggests that current AI has barely cleared the first hurdle of what we might call Living Intelligence. Being alive isn’t just about biological hardware; it is a fundamental way of processing reality through four interweaving layers that Silicon Valley has yet to replicate.

Layer 1: The World Model (The Map is Not the Territory)

The foundation of intelligence is World Modeling—the ability to maintain an internal simulation of how reality functions. This map allows us to make predictions and fill in the blanks when information is scarce.

The divide between your world model and an AI’s comes down to grounding. A human baby builds its map through a symphony of senses. Before a child understands the word "apple," they have felt its cool skin, smelled its sweetness, and tested its weight. When the word is finally learned, it "clicks" into a pre-existing physical reality.

LLMs, conversely, build their maps entirely from secondhand descriptions. This creates a staggering information gap. Consider color: the human eye can distinguish roughly one million shades, vastly outnumbering the words available in any dictionary to describe them. Or consider balance: you can read every physics textbook ever written, but you will not know how to stay upright on a bicycle until your inner ear and muscles negotiate with gravity. Because human intelligence is grounded in the physical world, it is resilient. AI intelligence, built on the "skewed and incomplete" echoes of human text, is prone to hallucinations that any five-year-old would catch with common sense.

Layer 2: Active Interaction (The Statue and the Security Camera)

If the world model is the map, then Active Interaction is the act of walking the terrain. Passive data—the billions of pages of text or millions of hours of video used to train AI—is fundamentally insufficient for a complete understanding of reality.

Imagine a statue in a park viewed through a fixed security camera. From one perspective, it appears to be a square. Is it a cube? A pyramid? A flat sheet? A passive AI must wait for someone else to move the camera or the statue to find out. A human, however, simply walks around it.

This ability to move and test the world is how we move from correlation to causation. We see that ice cream sales and drowning incidents both spike in the summer. A passive system might assume sugar causes drowning. A living organism interacts with the variables, observing what happens when ice cream shops close or when the temperature drops, eventually uncovering the true cause: the weather.

"LLMs struggle to generalize beyond their training data because their causal models are shallow."

By changing things and observing the results, living things map the underlying mechanisms of the world. This is why AI often struggles to be truly original. While systems like AlphaGo famously produced "Move 37"—a move no human had ever played in the history of Go—it did so because it was operating in a "closed system." The rules of Go are fixed, the board is finite, and the AI could experiment within that digital sandbox millions of times. The real world, with its infinite variables and real-time consequences, offers no such shortcuts.

Layer 3: Intrinsic Drives (The Internal Compass)

Even if we granted an AI a physical body, it would stand frozen in the park, lacking an internal compass to tell it where to go. In living organisms, this compass is driven by two competing forces: the drive to Minimize Prediction Error (closing the gap between expectation and reality) and the Drive to Explore.

Consider a bacterium on a food pile. If it only minimized prediction error, it would stay put, correctly predicting that food is present until the resource ran out—a death sentence. Instead, organisms possess an innate urge to scout for the next meal before they actually need it. This "Exploit vs. Explore" tradeoff is the heartbeat of survival.

In AI, a human programmer usually sets a "knob" to determine how creative or "safe" a response should be. Living things, however, turn their own knobs. We shift our strategies moment-to-moment based on hunger, curiosity, or fear. We don't need a prompt to tell us to look around; our biological needs ensure we are never stuck in a loop of repetitive, "safe" actions.

Layer 4: Metacognition (The recursive power of "Self")

The final and most sophisticated layer is Metacognition, or the ability to think about our own thinking. This is a "second-level" world model that doesn't just monitor the external environment, but also our own internal biases, feelings, and flaws.

Current AI attempts a version of this through "thinking modes," breaking problems into steps. But this often falls into the Lost Hiker Problem: if you are lost in the woods with the wrong map, "thinking harder" or walking faster won't help. You need to stop, look up, and realize the map itself is the problem.

Metacognition allows humans to watch themselves from a third-person perspective. It is a "slow burn" in our development; while we have basic drives at birth, the prefrontal cortex—the seat of executive function and self-reflection—doesn’t fully mature until our mid-20s. Crucially, this layer allows for recursive nesting. When we apply reflection to others, we develop empathy. We build a model of how they think about us, creating a shared understanding that forms the basis of trust and society. While AI learning stops the moment training ends, humans continue to refine these recursive loops for a lifetime.

Conclusion: From Replacement to Collaboration

True intelligence is not a solitary brain in a vat; it is a distributed phenomenon. It resides in our muscles, our gut, and our social institutions. Markets, democracies, and scientific communities are higher-order layers of intelligence that have evolved over millennia to process reality at a civilizational scale.

Rather than viewing AI as a competitor intended to replace the human mind, we should see it as a potential new layer in this hierarchy. Evolution and game theory suggest that the most successful systems are those that embrace collective cooperation. The goal is not to build a machine that mimics our text, but to develop a tool that integrates with our biological, individual, and societal layers—amplifying our shared wisdom rather than merely reflecting our data. The question is not whether AI will outsmart us, but whether we can build an AI that helps us navigate a world far more complex than any dataset can ever capture.

For all 2026 published articles list: click here

...till the next post, bye-bye & take care