> For the complete documentation index, see [llms.txt](https://mun.gitbook.io/c/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mun.gitbook.io/c/solution/8-character-and-string/7.3-ascii-code.md).

# 7.3 ASCII Code

## 7.3 ASCII Code

1. \[3] Print the Character Variable as a Character and ASCII Code Value.
2. \[4] Print all the Digits with their ASCII Code Value separated by a space, and each digit in a separate line.
3. \[5] Print all the Uppercase Letters with their ASCII Code Values separated by a space, and each letter in a separate line.
4. \[6] Print all the Lowercase Letters with their ASCII Code Values separated by a space, and each letter in a separate line.
5. \[7] Print all the ASCII Characters with their ASCII Code Values.
6. \[8] Input a Character and Print that character and its ASCII Code.

## সমাধান

### \[3] Print the Character Variable as a Character and ASCII Code Value.

{% code lineNumbers="true" %}

```c
#include<stdio.h>
int main(){
    char ch = 'A';
    
    printf("Character: %c\n", ch);
    printf("ASCII Code: %d\n", ch);
    
    return 0;
}
```

{% endcode %}

### \[4] Print all the Digits with their ASCII Code Value separated by a space, and each digit in a separate line.

{% code lineNumbers="true" %}

```c
#include<stdio.h>
int main(){
    char ch;
    
    printf("Char => ASCII\n");
    for(ch = '0'; ch <= '9'; ch++) {
        printf("%c => %d\n", ch, ch);
    }
    
    return 0;
}
```

{% endcode %}

### \[5] Print all the Uppercase Letters with their ASCII Code Values separated by a space, and each letter in a separate line.

{% code lineNumbers="true" %}

```c
#include<stdio.h>
int main(){
    char ch;
    
    printf("Char => ASCII\n");
    for(ch = 'A'; ch <= 'Z'; ch++) {
        printf("%c => %d\n", ch, ch);
    }
    
    return 0;
}
```

{% endcode %}

### \[6] Print all the Lowercase Letters with their ASCII Code Values separated by a space, and each letter in a separate line.

{% code lineNumbers="true" %}

```c
#include<stdio.h>
int main(){
    char ch;
    
    printf("Char => ASCII\n");
    for(ch = 'a'; ch <= 'z'; ch++) {
        printf("%c => %d\n", ch, ch);
    }
    
    return 0;
}
```

{% endcode %}

### \[7] Print all the ASCII Characters with their ASCII Code Values.

{% tabs %}
{% tab title="char" %}
{% code lineNumbers="true" %}

```c
#include<stdio.h>
int main(){
    char ch;
    
    printf("Char => ASCII\n");
    for(ch = 0; ch < 127; ch++) {
        printf("%c => %d\n", ch, ch);
    }
    
    return 0;
}
```

{% endcode %}
{% endtab %}

{% tab title="unsigned char" %}
{% code lineNumbers="true" %}

```c
#include<stdio.h>
int main(){
    unsigned char ch;
    
    printf("Char => ASCII\n");
    for(ch = 0; ch < 255; ch++) {
        printf("%c => %d\n", ch, ch);
    }
    
    return 0;
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

### \[8] Input a Character and Print its ASCII Code.

{% code lineNumbers="true" %}

```c
#include<stdio.h>
int main(){
    char ch;
    
    scanf(" %c", &ch);
    printf("Character: %c ASCII Code: %d\n", ch, ch);
    
    return 0;
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mun.gitbook.io/c/solution/8-character-and-string/7.3-ascii-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
