#include<stdio.h>

int main()
{
char ch;
printf("Enter Your State Name : ");
scanf("%c",&ch);

if(ch == 'a')
printf("Shipping Charge : $25");

else if(ch == 'b')
printf("Shipping Charge : $50");
else if(ch == 'c')
printf("Shipping Charge : $65");

else
printf("The state not in purchase");

return 0;
}

Tell me what wrong

Your Program is fine. I have compiled it. It is working. Whats your problem.

For any query you can contact me. I can provide you free online tutoring.

You can whatsapp me 00923215081005

Nothings really wrong, only states go off of 2 characters.

texas: TX

Thats really the only thing i can think of. No one knows what state "a" is but everyone knows that "AR" is Arkansas.

In your code, there is a logical error in the input and comparison process. Let's go through the code to understand the issue:

1. You declared a variable `ch` of type `char`.
2. You used `printf` to prompt the user to enter their state name.
3. You used `scanf` to read a single character input from the user into the variable `ch`.

Now, the problem lies in the comparison part:

4. You used if-else statements to compare the value of `ch` with characters 'a', 'b', and 'c'.
5. If the value of `ch` matches 'a', it should print "Shipping Charge: $25".
6. If the value of `ch` matches 'b', it should print "Shipping Charge: $50".
7. If the value of `ch` matches 'c', it should print "Shipping Charge: $65".
8. If the value of `ch` doesn't match any of the above cases, it should print "The state not in purchase".

The issue in the code is that you are comparing the character entered by the user with single quotes `'a'`, `'b'`, or `'c'`. However, you are using `scanf` with `%c` format specifier, which reads a single character. So, the user should only input a single character, not a string.

To fix this issue, you can modify your code as follows:

```c
#include <stdio.h>

int main() {
// Declare a string variable instead of a char variable
char state[50];

printf("Enter Your State Name: ");
// Use fgets to read the string input from the user
fgets(state, sizeof(state), stdin);

// Compare the first character of the string
if (state[0] == 'a') {
printf("Shipping Charge: $25");
}
else if (state[0] == 'b') {
printf("Shipping Charge: $50");
}
else if (state[0] == 'c') {
printf("Shipping Charge: $65");
}
else {
printf("The state is not available for purchase");
}

return 0;
}
```
Now, when you run the modified code, it will correctly read the state name as a string and compare the first character with 'a', 'b', or 'c' to determine the shipping charge.