C Program to Find ASCII Value of a Character with Output किसी अक्षर की ASCII Value ज्ञात करने हेतु सी प्रोग्राम

ASCII stands for American Standard Code for Information Interchange. It is a standard character encoding system used in computers to represent characters, numbers, and symbols using numeric values.

ASCII का पूर्ण रूप American Standard Code for Information Interchange है। यह एक standard character encoding system है जिसका उपयोग computers में characters, numbers तथा symbols को numeric values के रूप में दर्शाने के लिए किया जाता है।

Every character in the keyboard has a unique ASCII value. For example:

Keyboard के प्रत्येक character की एक unique ASCII value होती है। उदाहरण:

  • A = 65, B = 66, ..., Z = 90

  • a = 97, b = 98, ..., z = 122

  • 0 = 48, 1 =49, ..., 9=57

In C language, characters are internally stored as integer ASCII values, therefore we can easily print the ASCII value of a character using format specifiers.

C language में characters internally integer ASCII values के रूप में store होते हैं, इसलिए हम format specifiers की सहायता से किसी character का ASCII value आसानी से print कर सकते हैं।


What is ASCII? ASCII क्या है?

ASCII is a character encoding standard developed to allow communication between computers and electronic devices.

ASCII एक character encoding standard है जिसे computers तथा electronic devices के बीच communication के लिए विकसित किया गया था।

ASCII uses numbers from:

  • 0 to 127 in standard ASCII

  • 0 to 255 in extended ASCII

ASCII निम्न numeric range का उपयोग करता है:

  • Standard ASCII में 0 से 127

  • Extended ASCII में 0 से 255


Algorithm एल्गोरिथ्म

  1. Start the program

  2. Declare a character variable

  3. Input any character from user

  4. Print the ASCII value using %d format specifier

  5. Stop the program


C Program to Find ASCII Value of a Character  किसी अक्षर की ASCII Value ज्ञात करने हेतु सी प्रोग्राम

#include<stdio.h>
int main()
{
char ch;
printf("Enter any character: ");
scanf("%c",&ch);
printf("ASCII Value of %c = %d",ch,ch);
return 0;
}


Output आउटपुट

Example 1

Enter any character: A
ASCII Value of A = 65

Example 2

Enter any character: a
ASCII Value of a = 97

Example 3

Enter any character: 5
ASCII Value of 5 = 53

Explanation of the Program प्रोग्राम की व्याख्या

#include<stdio.h>

This header file is used for standard input-output functions like printf() and scanf().

यह header file printf() तथा scanf() जैसे input-output functions के लिए उपयोग होती है।


char ch;

A character variable named ch is declared to store a single character entered by the user.

यहाँ ch नाम का character variable declare किया गया है जो user द्वारा input किए गए single character को store करता है।


scanf("%c",&ch);

This statement accepts a single character from the user.

यह statement user से एक character input लेता है।


printf("ASCII Value of %c = %d",ch,ch);

Here:

  • %c prints the character

  • %d prints the ASCII integer value of the character

यहाँ:

  • %c character को print करता है

  • %d character की ASCII integer value को print करता है

Since characters are internally stored as integers, the same variable can print both character and ASCII value.

क्योंकि characters internally integer form में store होते हैं, इसलिए वही variable character और ASCII value दोनों को print कर सकता है।


How ASCII Conversion Works Internally ASCII Conversion Internally कैसे कार्य करता है

When a character is entered:

  • Computer stores it as a binary number

  • That binary number represents an ASCII code

  • C language converts it automatically into integer format when %d is used

जब कोई character input किया जाता है:

  • Computer उसे binary number के रूप में store करता है

  • वह binary number ASCII code को represent करता है

  • %d format specifier उपयोग करने पर C language उसे automatically integer format में convert कर देती है।


Real-Life Applications of ASCII ASCII के वास्तविक उपयोग

ASCII values are used in: ASCII values का उपयोग निम्न क्षेत्रों में किया जाता है:

  • Character Encoding

  • Keyboard Input Processing

  • Compiler Design

  • Encryption Systems

  • Networking Protocols

  • Text Editors

  • Data Communication

Important Viva Questions महत्वपूर्ण Viva Questions

Q1. What is ASCII?

ASCII is a standard character encoding system used to represent characters using numeric values.

ASCII एक standard character encoding system है जो characters को numeric values द्वारा represent करता है।


Q2. What is the ASCII value of character A?

The ASCII value of A is 65.

Character A की ASCII value 65 होती है।


Q3. Which format specifier is used to print ASCII value?

%d format specifier is used.

ASCII value print करने के लिए %d format specifier का उपयोग किया जाता है।


Q4. Which data type is used to store characters in C?

char data type is used.

C language में characters store करने के लिए char data type उपयोग होता है।


Key Concepts Used उपयोग किए गए मुख्य Concepts

  • Character Data Type

  • ASCII Encoding

  • Input-Output Functions

  • Format Specifiers

  • Type Conversion

This program is one of the most important beginner-level C programs because it helps students understand character representation, ASCII encoding, and format specifiers. It also builds a foundation for advanced topics such as string handling, encryption, compiler design, and text processing.

यह program beginners के लिए अत्यंत महत्वपूर्ण है क्योंकि इससे character representation, ASCII encoding तथा format specifiers को समझने में सहायता मिलती है। यह आगे के advanced topics जैसे string handling, encryption, compiler design तथा text processing की मजबूत foundation तैयार करता है।


Comments

Popular posts from this blog

C Language Topics in Hindi and English

Top High-Paying Tech Skills to Learn in 2025

Advanced C Programming Language IMP Questions for BSc/BA/BCom/BCA/BE/BTech/MSc/MCA (CS/IT) Students