Can someone tell me what is wrong with this code?

/ reading in characters using getchar and printing with putchar /
#include<stdio.h>

int main()

{

char ch1, ch2, ch3;

printf(“Enter three characters\n”);

ch1 = getchar();

ch2 = getchar();

ch3 = getchar();

printf("\nYou entered:");

putchar(ch1);

putchar(ch2);

putchar(ch3);

printf("\n\nwhich have ascii codes: %d %d %d\n", ch1, ch2, ch3);

}

I am supposed to debug this and find out what is wrong, that is all I was told

You will need to tell us what you expect it to do vs. what happens when you run it currently.

1 Like