# 7.2 Character Input

## 7.2 Character Input

1. \[0.5] Take a Character input from the user and print the Character. _(Repeated)_
2. \[0.6] Take two Character inputs separated by space/newline from the user and print both Characters. _(Repeated)_
3. \[1] Take Character input and print the character for N times (Take Input N from the user at the beginning)
4. \[2] Take Character input until the input is "0".

## সমাধান

### \[0.5] Take a Character input from the user and print the Character. _(Repeated)_

{% code lineNumbers="true" %}
```c
#include<stdio.h>
int main(){
    char ch;
    
    scanf("%c", &ch);
    printf("%c\n", ch);
    
    return 0;
}
```
{% endcode %}

### \[0.6] Take two Character inputs separated by space/newline from the user and print both Characters. _(Repeated)_

{% code lineNumbers="true" %}
```c
#include<stdio.h>
int main(){
    char ch1, ch2;
    
    scanf(" %c %c", &ch1, &ch2);
    printf("%c %c\n", ch1, ch2);
    
    return 0;
}
```
{% endcode %}

### \[1] Take Character input and print the character for N times (Take Input N from the user at the beginning)

{% code lineNumbers="true" %}
```c
#include<stdio.h>
int main(){
    int n, i;
    char ch;
    
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf(" %c", &ch);
        printf("%c\n", ch);
    }
    
    return 0;
}
```
{% endcode %}

### \[2] Take Character input until the input is "0".

{% code lineNumbers="true" %}
```c
#include<stdio.h>
int main(){
    char ch;
    
    while(scanf(" %c", &ch) && ch != '0') {
        printf("%c\n", ch);
    }
    
    return 0;
}
```
{% endcode %}
