#include #include int main(void) { int h,n,r,i,j,a[100],bandera; i=0; printf("Ingresa el numero: "); scanf("%d", &n); while(n != 0) { a[i] = n%2; n=n/2; i++; } for(j = i-1; j>=0; j--){ printf("%d",a[j]); } i = 0; bandera = 0; do{ if(a[i] == 1){ bandera=1; } else { i++; } } while(bandera == 0){ for(h=i+1;h<=j;h++){ if(a[h] == 1){ a[h]= 0; } else { a[h]=1; } } } system("pause"); }