int S1; // assigning a variable S1 int S2; // assigning another variable S2 S1=PINx&0b00000001; //Give your one input at first pin of x port S2=PINx&0b00000010; //Give your other input at second pin of x port while(1) { if(S1==1 && S2==2) //If both pins taking high input { // operational code } }