Answer to Question #286622 in C for jay

Question #286622

5. Input Combination

by CodeChum Admin

We’ve tried adding together integers, so how about adding characters as well? Well, we can’t do that with the knowledge we have now, so let’s use placeholders to do the trick!


Instructions:

  1. Input two characters in one line, separated by a space.
  2. Make the characters be printed out like it’s concatenated by printing it without spaces in between using placeholders. Refer to the sample output for your reference.
  3. In your scanf, don't forget to add a space in between the two placeholders for the characters because if you don't, the character that will be scanned for the second variable would actually be the space in between the two characters (because a space is also a character).

Input


1. First character

2. Second character

Output


The first two lines will contain message prompts to input the two characters.

The last line contains the two characters together.


Enter·the·first·character:·A

Enter·the·second·character:·B

AB


1
Expert's answer
2022-01-11T09:44:25-0500
#include <stdio.h>

int main() {
    char ch1, ch2;

    scanf("%c %c", &ch1, &ch2);
    printf("%c%c\n", ch1, ch2);

    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS