Contents

Views 12271 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
소스코드
#include<stdio.h>

main()
{
    int max, min,c,i,j,cdmin,csmax;
    for(;;)
    {
        printf("임의의값 2개중 1개를 입력하시오");
        scanf("%d", &max);
        printf("임의의값 2개중 나머지 1개를 입력하시오");
        scanf("%d", &min);
        if (max<min)
        {
            c=max;
            max=min;
            min=c;
            printf("MAX=%dMIN=%d\n",max, min );
        }
        else if (max>min)
            printf("max=%dmin=%d\n",max, min );
        else 
        {
            printf("같다.\n");
            break;
        }

        printf("최대공약수는 1을 최소공배수는 2를입력하시오");
        scanf("%d",&c);
        if (c==1)
        {
            for(i=1 ; i<=min ; i++)
            {
                if (min%i==0 && max%i==0)
                    cdmin=i;
            }
            if (cdmin==1)
                printf("서로소인수\n");
            else
                printf("최대공약수=%d\n",cdmin);
        }
        else
        {
            csmax=0;
            for(i=1 ; i<=999 ; i++)
            {
                for(j=1; j<=999 ; j++)
                {
                    if (min*i==max*j)
                    {
                        csmax=min*i;
                        break;
                    }
                }
                if (csmax!=0)
                    break;
            }
            printf("최소공배수=%d\n",csmax);
        }
        printf("계속할라믄 1번을 종료할라믄 2번을...");
        scanf("%d", &c);
        if(c!=1)
            break;
    }
}



?

List of Articles
No. Category Subject Author Date Views
183 Develop [php][laravel] 라라벨 개발환경 세팅하기 (Mac, Window) 2 file hooni 2017.12.15 5549
182 Develop [Android Error] The number of method references in a .dex file cannot exceed 64K hooni 2016.11.10 5485
181 Develop [js] Javascript로 만든 포트리스 (2010) 5 file hooni 2017.03.03 5480
180 Develop [ios] AES256 알고리즘을 이용해 데이터 암호화/복호화 방법 file hooni 2015.07.21 5457
179 Develop [android] 초간단 얼럿 (AlertDialog) hooni 2016.10.21 5448
178 Develop [ios] iOS 7 이상 UIBarButtonItem 여백 file hooni 2014.03.27 5381
177 Develop What is difference between Get, Post, Put and Delete? hooni 2018.02.28 5340
176 Develop [ios] 앱딜리게이트 라이프사이클 (AppDelegate Lifecycle) file hooni 2014.05.09 5336
175 Develop [ios] URL Scheme 이용하여 앱 설치 확인 hooni 2014.03.10 5282
174 Develop [ios] iOS 의 인앱구매 소개 file hooni 2014.04.29 5252
173 Develop [ios][swift] 초간단 TableView 샘플 file hooni 2016.06.27 5218
172 Develop [swift] UIView에서 subview 찾기 hooni 2022.12.09 5184
Board Pagination Prev 1 ... 51 52 53 54 55 56 57 58 59 60 ... 71 Next
/ 71