# 7.5 Character Conversion

## 7.5 Character Conversion

1. \[19] to\_lower - Convert an Uppercase Letter to a Lowercase Letter.
2. \[20] to\_upper - Convert a Lowercase Letter to a Uppercase Letter.
3. \[21] reverse\_case - Reverse Case (If the character is in uppercase convert it to lowercase and vice versa)

## সমাধান

### \[19] to\_lower - Convert an Uppercase Letter to a Lowercase Letter.

{% code lineNumbers="true" %}

```c
#include<stdio.h>
int main() {
    char ch, lower_case;
    
    scanf(" %c", &ch);
    if(ch >= 'A' && ch <= 'Z'){
        lower_case = ch - 'A' + 'a';
        printf("%c\n", lower_case);
    }
    else{
        printf("%c\n", ch);
    }

    return 0;
}
```

{% endcode %}

### \[20] to\_upper - Convert a Lowercase Letter to a Uppercase Letter.

{% code lineNumbers="true" %}

```c
#include<stdio.h>
int main() {
    char ch, upper_case;
    
    scanf(" %c", &ch);
    if(ch >= 'a' && ch <= 'z'){
        upper_case = ch - 'a' + 'A';
        printf("%c\n", upper_case);
    }
    else{
        printf("%c\n", ch);
    }

    return 0;
}
```

{% endcode %}

### \[21] reverse\_case - Reverse Case (If the character is in uppercase convert it to lowercase and vice versa)

{% code lineNumbers="true" %}

```c
#include<stdio.h>
int main() {
    char ch, reverse_case;
    
    scanf(" %c", &ch);
    if(ch >= 'A' && ch <= 'Z'){
        reverse_case = ch - 'A' + 'a';
    }
    else if(ch >= 'a' && ch <= 'z'){
        reverse_case = ch - 'a' + 'A';
    }
    else{
        reverse_case = ch;
    }
    printf("%c\n", reverse_case);

    return 0;
}
```

{% endcode %}


---

# Agent Instructions: 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.5-character-conversion.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.
