In this video tutorial we show you how to write C program to print all the upper case alphabets(A-Z) using simple while loop.
Related Read:
while loop in C programming
Note: In C programming language, every character variable holds an ASCII value rather than the character itself. You can check ASCII value of all the characters here: C Program To Print All ASCII Characters and Code
Note:
ASCII value range of upper case alphabets:
ASCII value of A is 65.
ASCII value of B is 66.
ASCII value of C is 67.
and so on till Z ..
ASCII value of Z is 90.
Source Code: C Program To Print Uppercase Alphabet(A-Z) using While loop
#include < stdio.h > int main() { char ch = 'A'; printf("Uppercase English Alphabets:\n"); while(ch <= 'Z') { printf("%c ", ch); ch++; } printf("\n\n"); return 0; }
Output:
Uppercase English Alphabets:
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
Logic To Print Uppercase Alphabet(A-Z) using While loop
Each alphabet has it’s own(unique) ASCII value. So we initialize the character variable to A, and then using while loop we iterate until our character variable is equal to Z. C program checks with the characters underlying ASCII values. Inside while loop we increment the value of character variable by one for each iteration and also print the character present in it.
Video Tutorial: C Program To Print Uppercase Alphabet(A-Z) using While loop
[youtube https://www.youtube.com/watch?v=NTNsLcMeYRE]
For list of all c programming interviews / viva question and answers visit: C Programming Interview / Viva Q&A List
For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert