nearly same solutions,but one gives correct & other one gives wrong answer,what's the problem?

I submitted two solutions for the elevators and stairs problem,the first one which gives wrong answer and the another one which gives correct answer.please help me find out what is the difference between the two.

Order of scanf statements is different :slight_smile:

scanf("%d",&n);
scanf("%d",&V1);
scanf("%d",&V2);

Also one solution prints new lines while the other doesn’t

if(s<e){printf("Stairs");}
else {printf("Elevator");}

Print a answer on new line. :slight_smile:

does order of scanf and new lines for answer matter?

I changed the scanf order but still it is giving wrong answer

tried it.but no use