Contents

Views 8875 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
21 Develop [c] 소수점 반올림^^ hooni 2003.04.23 8480
» Develop [c] 최대공약수 알고리즘 (유클릿) hooni 2003.04.23 8875
19 Develop [php] whois정보 조회 프로그램 hooni 2003.04.23 11735
18 Develop [c] 간단한 링크드 리스트(linked list) 자료형 예제.. hooni 2003.04.23 9841
17 Develop [c] CGI Library to C^^ hooni 2003.04.23 8425
16 Develop [c] scanf(), printf() 포맷의 형변환 hooni 2003.04.23 10858
15 Develop [c] home env stack overflow hooni 2003.04.23 11518
14 Develop [c] 파일입출력 간단한 설명 hooni 2003.04.23 11245
13 Develop [C] C언어의 조건 연산자(Conditional Operator) hooni 2003.04.23 14230
12 Database [mysql] 접속과 테이블 생성 간단한 설명.. hooni 2003.04.23 18657
11 Develop [vb] 비쥬얼 베이직으로.. hooni 2003.04.23 53003
10 Develop [c] 재미있는 코딩.. file hooni 2003.04.23 21318
Board Pagination Prev 1 ... 89 90 91 92 93 94 95 96 97 98 Next
/ 98