Alphabetic order

Hi,
Sorry to disturb you again, but I got stuck another time :(((
I'm trying to code a program which ask me for letters and then tell me If they're in the alphabetic order.
I tried this one, It is working but it asks me for the first number and then says that they're not in the order.
What Am I doing wrong?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include<stdio.h>
#include<conio.h>
int main()
{
char A,B,C;

    printf("Donnez le 1er caractere\n");
	scanf("%c",&A);
    printf("Donnez le 2eme caractre\n");
    scanf("%c",&B);
    printf("Donnez le 3eme caractère\n");
    scanf("%c",&C);
{
    if (A<B && B<C)
    printf("Ils sont rangés\n");	
    else
    printf("Ils sont pas rangés\n");
}
    
    
getch();
return 0;
}
    

Thanks and sorry for your time.
Last edited on
Try placing a space in front of the "%" in your scanf() format specifier string. This will tell scanf to skip leading white space.


Like this?
scanf("% ",&A);
When I applied this to all the code, nothing new happened I got the same result :-(
The problem is that It doesn't ask me to input B at all..
Last edited on
No I said in front of the % character so it becomes " %c"

Topic archived. No new replies allowed.