
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
C Program to print all ASCII values.
Problem
Print the American Standard Code for Information Interchange (ASCII) values of 0 to 255 characters without initializing the character to integer type variable. Simply, use the format specifier.
Solution
Here we are writing a program to print only from 65 to 122.
If you want to see all ASCII values, in for loop you can write as follows −
For(i=0;i<255;i++)
Then, it prints all the ASCII values from 0 to 255.
The logic used to print the ASCII values from 65 to 122 is as follows −
Prints ASII values From A to z for (i = 65; i < =122; i++){ printf("%c \t\t %d
", i, i); }
Example
Following is the C program to print the ASCII values from 65 to 122 −
#include <stdio.h> int main() { // Declare Variables int i = 0; printf("Character \t ASCII Value
"); //Print ASCII Values for (i = 65; i <=122; i++) { printf("%c \t\t %d
", i, i); } return 0; }
Output
When the above program is executed, it produces the following output −
Character ASCII Value A 65 B 66 C 67 D 68 E 69 F 70 G 71 H 72 I 73 J 74 K 75 L 76 M 77 N 78 O 79 P 80 Q 81 R 82 S 83 T 84 U 85 V 86 W 87 X 88 Y 89 Z 90 [ 91 \ 92 ] 93 ^ 94 _ 95 ` 96 a 97 b 98 c 99 d 100 e 101 f 102 g 103 h 104 i 105 j 106 k 107 l 108 m 109 n 110 o 111 p 112 q 113 r 114 s 115 t 116 u 117 v 118 w 119 x 120 y 121 z 122
- Related Articles
- Haskell program to print ascii values
- Java Program to Print the ASCII values
- Swift Program to Print the ASCII values
- Kotlin Program to Print the ASCII values
- C program to print the ASCII values in a string.
- How to print the ASCII values in Golang?
- Java program to print ASCII value of a particular character
- C# program to print unique values from a list
- C++ program to print values in a specified format
- Minimize ASCII values sum after removing all occurrences of one character in C++
- C# program to print all sublists of a list
- 8085 Program to convert two-digit hex to two ASCII values
- Convert a string to hexadecimal ASCII values in C++
- C Program to print all permutations of a given string
- Write a C program to print all files and folders.

Advertisements