Question: Below is the following question and my code, I do not understand why even if I enter an A or B it still says that

Below is the following question and my code, I do not understand why even if I enter an "A" or "B" it still says "that is not an A or B".

Ask the user to enter a character. Check to see if the character is an A or a B. If it is an A or a B print Thats an A or B, else print Not an A or a B. Then print Goodbye in both cases, but only use one print statement in the program to print Goodbye.

#include int main(void) { char c; printf("Enter a character: "); scanf("c%",&c); if(c=='A' || c=='B') { printf("That is an A or B "); } else { printf("That's not an A or B "); } printf("Goodbye"); return(0); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!