💻 C Program Code to Print a to z Alphabets

#include <stdio.h> int main() { char ch = 'a'; printf("Lowercase alphabets from a to z:\n"); while(ch <= 'z') { printf("%c ", ch); ch++; // move to next character } return 0; }

📌 Output

Lowercase alphabets from a to z: a b c d e f g h i j k l m n o p q r s t u v w x y z

🧠 How This Program Works

  • Step 1: Start with a character variable and assign it the value 'a'.
  • Step 2: Use a loop that runs until the character reaches 'z'.
  • Step 3: Inside the loop, print the current character.
  • Step 4: Increase the character by 1 to move to the next alphabet.
  • Step 5: Repeat until all lowercase letters from a to z are printed.

⚡ Key Concept: Characters and ASCII Values

In C, characters like 'a', 'b', 'c' are stored as numbers called ASCII values. Each character has a specific number behind it.

For example, 'a' = 97 and 'z' = 122. When we do ch++, C automatically moves to the next ASCII number, which is the next letter. That’s how the program prints all lowercase letters from a to z easily.

🚀 Practice Time!

Try these on your own whenever you're ready:

  • Print uppercase alphabets from A to Z
  • Print the alphabets in reverse order (Z to A)
  • Print only vowels (A, E, I, O, U) from A to Z

Common Questions About Printing Lowercase Letters in C

Q: How do I print all the lowercase letters from a to z in C?

A: You can start with a character set to 'a' and then use a simple loop that keeps printing the current letter and moving to the next one by using ch++. Keep doing this until you reach 'z'.

Q: Do I need to use ASCII codes to print lowercase letters?

A: Not at all! In C, you can just work with characters like 'a' through 'z' directly. The language handles the ASCII values behind the scenes, so you don’t have to worry about numbers.

Q: What’s the ASCII range for lowercase letters?

A: Lowercase letters run from 97 ('a') to 122 ('z') in ASCII. But you don’t need to memorize these numbers — just use the characters directly in your code.

Q: Which type of loop is best for this task — while or do-while?

A: Both work fine! Usually, a while loop is simpler for this kind of task, but a do-while can also do the job if you prefer.

Q: Why do we add ch++ in the program?

A: The ch++ command moves to the next character in the sequence — from 'a' to 'b', then 'c', and so on. It’s a quick way to go through all the letters.

Q: Is learning this useful for exams or coding interviews?

A: Definitely! It’s a common question that shows you understand loops, characters, and how ASCII works in C — all important basics for programming tests.


🔥 C While & Do-While Loop Programs (Practice Set 1)

🚀 Practice the most important C while loop and do-while loop programs asked in exams and interviews. These beginner-to-advanced problems will help you master loop concepts quickly.

  1. C Program to Print Odd Numbers from 1 to N (While & Do-While)

    Learn how to print odd numbers using loops in C. A basic problem to understand loop iteration.

  2. C Program to Print Even Numbers from 1 to N

    Understand how to display even numbers using while and do-while loops in C.

  3. C Program to Print Uppercase Alphabets (A to Z)

    Print all uppercase letters using loops. Helps in understanding ASCII values and iteration.

  4. C Program to Print Lowercase Alphabets (a to z)

    Simple loop program to print lowercase alphabets in C.

  5. C Program to Print Numbers from 1 to 10

    Basic beginner example to understand number printing using loops.

  6. C Program to Print Multiplication Table using While Loop

    Take user input and generate a multiplication table. Common interview question.

  7. C Program to Check Positive, Negative or Zero

    Check number type continuously using loops until user exits.

  8. C Program to Find Factorial using While Loop

    Calculate factorial using loops. Important for coding interviews.

  9. C Program to Find Sum of First N Natural Numbers

    Compute sum from 1 to N using loop logic. Core beginner problem.

  10. C Program to Print Prime Numbers from 1 to N

    Learn prime number logic using nested loops in C programming.

  11. C Program to Print Armstrong Numbers from 1 to N

    Understand Armstrong number logic using loops and mathematical operations.

  12. C Program to Print Leap Years using While Loop

    Find leap years using conditions and loops. Useful for real-world logic building.

  13. C Program to Reverse a Number using While Loop

    Reverse digits of a number using loops. Frequently asked interview question.


📘 Practice/Assignment Set 2: C While & Do-While Loop Series Programs

1. C Program to Find Sum of Squares from 1 to N using While Loop
Learn how to calculate the sum of squares (1² + 2² + 3² + ... + N²) using while and do-while loops in C. This is a commonly asked logic-building problem in exams and coding interviews.

2. C Program to Find Sum of First N Natural Numbers using While Loop
Write a C program to calculate the sum of natural numbers (1 + 2 + 3 + ... + N) using loops. A basic and important program for beginners learning loop concepts.

3. C Program to Find Sum of Series (1/1! + 2/2! + ... + N/N!)
Practice a slightly advanced loop problem by computing the sum of factorial-based series using while or do-while loops. Helps strengthen logic and mathematical programming skills.

4. C Program to Find Sum of Harmonic Series (1 + 1/2 + 1/3 + ... + 1/N)
Learn how to calculate the harmonic series using loops in C. This program improves understanding of floating-point calculations and loop control.

5. C Program to Find Sum of Series (1 + 3²/3³ + 5²/5³ + ... up to N Terms)
Solve an advanced series-based problem using while loop logic. This type of question is frequently asked in competitive programming and technical interviews.

Other Tutorials
SQL FAQJava FAQPython FAQ


Previous Topic:-->> Difference Between while and do while loop in C || Next topic:-->>Write C program to show EVEN numbers from 1 to N using while loop and do while loop.