Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Can someone figure out why this will not work properly?

0 votes
asked Nov 7, 2018 by CWMcLoughlin (120 points)
#include <stdio.h>
int main(void)
{
        char a,b,c;
        printf("a= ");
        scanf("%c", &a);
        printf("b= ");
        scanf("%c", &b);
        printf("c= ");
        scanf("%c", &c);
        printf("%c %c %c", a, b, c);
        return 0;
}

2 Answers

0 votes
answered Nov 8, 2018 by Marshall (390 points)
What do you want it to do?
0 votes
answered Nov 11, 2018 by murfo

#include <stdio.h>
int main(void) {
    char a,b,c;
    printf("a= ");
    scanf("%c", &a);
    while(getchar() != '\n');
    printf("b= ");
    scanf("%c", &b);
    while(getchar() != '\n');
    printf("c= ");
    scanf("%c", &c);
    printf("%c %c %c", a, b, c);
    return 0;
}

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...