Contents

Views 8909 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
645 Develop [c] OpenGL 직사각형(2D) 크기 확대/축소 hooni 2003.04.23 9097
644 Develop [js] 객체 머지.. hooni 2013.12.17 8995
643 Develop [c][java] 주사선 채우기 알고리즘(scan line filling algorithm) 구현 file hooni 2013.04.23 8989
642 Database [mysql] 쿼리 실행시 ERROR 1366 (HY000) : incorrect string value : for column 3 hooni 2017.03.30 8963
641 Develop [c++] 바탕화면 테두리에 자석처럼 붙는 스냅효과.. file hooni 2013.04.23 8932
640 Develop [js] 밀리터리 프로그램(전역일 계산) 7 file hooni 2013.04.23 8931
» Develop [c] 최대공약수 알고리즘 (유클릿) hooni 2003.04.23 8909
638 Develop [js] jQjuery $ 활용 hooni 2013.12.17 8906
637 Develop [c++] 채팅로봇 소스.. ㅋㄷㅋㄷ file hooni 2013.04.23 8902
636 Develop [c] 약수/최대공약수/완전수 알고리즘 hooni 2003.04.23 8898
635 Develop [js] 초간단 암호화/복호화 소스.. hooni 2003.04.23 8880
634 Develop [html] SVG(Scalable Vector Graphics) 간단 정리 hooni 2014.02.13 8867
Board Pagination Prev 1 ... 40 41 42 43 44 45 46 47 48 49 ... 98 Next
/ 98