Advertisement
aulas4you

como gerar todas combinações mega sena

Apr 5th, 2018
992
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include<stdio.h>
  2. int main () {
  3. FILE *arquivo;
  4. int a=1,b=2,c=3,d=4,e=5,f=6;
  5. int aa=0,bb=0,cc=0,dd=0,ee=0,ff=0;
  6. int contador=0;
  7.  arquivo=fopen("aulas4you.txt","w" );
  8. aa=0;
  9. for(a=1;a<=55;a++){
  10. bb=0;
  11. for(b=bb+1+a;b<=57;b++){
  12. cc=0;
  13. for(c=cc+1+b;c<=58;c++){
  14. dd=0;
  15. for(d=dd+1+c;d<=59;d++){
  16. ee=0;
  17. for(e=ee+1+d;e<=60;e++){
  18. ff=0;
  19. for(f=e+1;f<=60;f++){
  20. fprintf(arquivo," %d %d %d %d %d %d \n " ,a,b,c,d,e,f);}
  21.  if(f==61){ee++;}
  22.  } if(e==60){dd++;}
  23.  } if(d==59){cc++;}
  24.  } if(c==58){bb++;}
  25.  } if(b==57){aa++;}
  26.  }
  27.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement