SHARE
TWEET

Untitled

a guest Jan 12th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <conio.h>
  3.  
  4. int B[]={0,0,0,0,0}, n=5, OK=1, count=0;
  5. void Result(void){
  6.     printf("\nBuoc %3d:",++count);
  7.     for (int i=0; i<n; i++) printf("%2d",B[i]);
  8. }
  9.  
  10. void Function1(void){
  11.     int i;
  12.     for(i=n-1; i>=0 && B[i]; i--){
  13.         B[i] =0;
  14.     }
  15.     if(i>=0) B[i]=1;
  16.     else OK=0;
  17. }
  18.  
  19. int main(void){
  20.     do {
  21.         Result();
  22.         Function1();
  23.     } while(OK);
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top