nguyên bản của nó là !
Code:
#include <stdio.h>
#include <conio.h>
int Stop, count=0;
void Result(int *B, int n){
int i;count++; printf("\n Ket qua %d:",count);
for(i=1; i<=n;i++) printf("%3d", B[i]);
}
void Function1(int *B, int n){
int i = n;while(i>0 && B[i]){ B[i]=0; i--; }
if(i==0 ) Stop=1; else B[i]=1;
}
void Function2(int *B, int n){
int i;Stop = 0;
while (!Stop) { Result(B,n);Function1(B,n);}
}
void main(void){
int B[]= {0,0,0,0}, n=4;Function2(B,n);
}
còn đây là bài em gõ !
Code:
#include <stdio.h>
#include <conio.h>
int Stop, count=0;
void Result(int *B, int n){
int i;count++; printf("\n Ket qua %d:",count);
for(i=1; i<=n;i++) printf("%3d", B[i]);
}
void Function1(int *B, int n){
int i = n;while(i>0 && B[i]){ B[i]=0; i--; }
if(i==0 ) Stop=1; else B[i]=1;
}
void Function2(int *B, int n){
int i;Stop = 0;
while (!Stop) { Result(B,n);Function1(B,n);}
}
void main(void){
int B[]= {0,0,0,0}, n=4;Function2(B,n);
}
nhưng cho kết quả thì khác nhau .
bạn nào biết giải thích giùm nhé !