#include char flipBit(char c); char flipBit(char c) { if (c == '0') return '1'; else return '0'; } int main() { char binaryNumber[] = { '0','0','0','0',0 }; int slot1,slot2,slot3,slot4; for (slot1=0 ; slot1 < 2 ; slot1++) { printf("\n%s",binaryNumber); for (slot2 =1 ; slot2 < 2 ; slot2++) { binaryNumber[slot2] = flipBit(binaryNumber[slot2]); printf("\n%s",binaryNumber); for (slot3=2 ; slot3 < 3 ; slot3++) { binaryNumber[slot3] = flipBit(binaryNumber[slot3]); printf("\n%s",binaryNumber); for (slot4=3 ; slot4 < 4 ; slot4++) { binaryNumber[slot4] = flipBit(binaryNumber[slot4]); printf("\n%s",binaryNumber); } } } binaryNumber[slot1] = flipBit(binaryNumber[slot1]); printf("\n"); } }