Contents

Views 8910 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>
#include<conio.h>

int gcd(int m, int n) {
    if (m<=0) return 0;
    if (n<=0) return 0;
    while(m != n){
        if (m>n) m = m - n;
        else n = n - m;
    }
    return n;
}

void main(){
    int a,b;

    printf("Enter a first Number : ");
    scanf("%d",&a);

    printf("Enter a second Number : ");
    scanf("%d",&b);

    printf("GCD is %d",gcd(a,b));
    getch();
} 


?

List of Articles
No. Category Subject Author Date Views
25 Develop [c++] p.47 연습문제 3번 hooni 2003.04.23 10150
24 Develop [opengl] 컴퓨터 그래픽스 강의 자료(수업자료) file hooni 2003.04.23 20526
23 Develop [c] 그래픽스 자료(OpenGL 라이브러리) 샘플 소스 file hooni 2003.04.23 10215
22 Develop [c] 간단한 채팅(클라이언트/서버) 프로그램 소스 file hooni 2003.04.23 9100
21 Develop [c] 팩토리얼.. - 재귀함수 hooni 2003.04.23 9529
20 Develop [c] 하노이탑 - 재귀함수 hooni 2003.04.23 9180
19 Develop [c] 소수점 반올림^^ hooni 2003.04.23 8502
» Develop [c] 최대공약수 알고리즘 (유클릿) hooni 2003.04.23 8910
17 Develop [php] whois정보 조회 프로그램 hooni 2003.04.23 11776
16 Develop [c] 간단한 링크드 리스트(linked list) 자료형 예제.. hooni 2003.04.23 9867
15 Develop [c] CGI Library to C^^ hooni 2003.04.23 8439
14 Develop [c] scanf(), printf() 포맷의 형변환 hooni 2003.04.23 10902
Board Pagination Prev 1 ... 62 63 64 65 66 67 68 69 70 71 Next
/ 71