in this program the compiler is compiling the both else if and else statements simultaneously in same for loop..... i wanna know wat is problem with the program

/* program to convert infix to postfix expression*/
#include<stdio.h>
#include<conio.h>

order(char a[],int );
void main()
{
int top=0,i,j=0,ok=0;
char a[100],d[100],s[100];
clrscr();

printf("Enter the infix expression:\t");
gets(a);

s[top]='#';

for(i=0;a[i]!='\0';i++)
{
if(a[i]==')')
{
for(;s[top]!='('
d[j++]=s[top--];
top--;ok=1;
}
else if((order(a,i))>(order(s,top))) /* the compiler is enterin the below else */
s[++top]=a[i]; /* after enterin elseif statement*/
else
{
d[j++]=s[top];
s[top]=a[i];
}
}
if(ok==0) top--;
while(s[top]!='#')
d[j++]=s[top--];

printf("\nthe postfix expression is:");
puts(d);
getch();
}

int order(char a[],int i)
{
switch(a[i])
{
case '*':
case '/':return 4;
case '(':return 5;
case '+':
case '-':return 3;
/* case ')':return 2;*/
case '#':return 1;
default:return 6;
}
}