lotto000.cpp
#include <stdio.h>
int main(int argc, char *argv[])
{
int count=0;
for(int a=1; a<=40; a++) {
for(int b=a+1; b<=41; b++) {
for(int c=b+1; c<=42; c++) {
for(int d=c+1; d<=43; d++) {
for(int e=d+1; e<=44; e++) {
for(int f=e+1; f<=45; f++) {
count++;
// 로또 8145060 조합 루프
// a,b,c,d,e,f 가 로또 번호
}}}}}}
printf("count = %d\n", count); // 결과: 8145060
getchar();
return 0;
}
로또 번호 1,2,3,4,5,6 부터 40,41,42,43,44,45 까지 순차적으로 8145060 회 순환하는 루프문 입니다.
a,b,c,d,e,f 가 로또 번호를 의미합니다.
'프로그래밍' 카테고리의 다른 글
로또번호 자동 생성 (응용편)(c/c++)(로또함수) (0) | 2014.08.04 |
---|---|
random, rand(), 큰수 랜덤, WELL 랜덤 (c/c++) (0) | 2014.08.04 |
로또번호 자동 생성 (랜덤, random)(c/c++)(로또함수) (0) | 2014.08.04 |
순서번호로 로또 조합 알아내기 (c/c++)(로또함수) (0) | 2014.08.03 |
로또번호로 몇번째 조합인지 알아내기 (c/c++)(로또함수) (0) | 2014.08.03 |