Contents

Views 8914 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
529 Develop [c] 암호 알고리즘 소스.. file hooni 2013.04.23 8354
528 Develop [c] 암호화 알고리즘 DES 구현 ㅋㅋ file hooni 2013.04.23 7453
527 Develop [c] 압축 알고리즘 소스 및 정리 file hooni 2013.04.23 8796
526 Develop [c] 약수/최대공약수/완전수 알고리즘 hooni 2003.04.23 8904
525 Develop [c] 연산자 우선순위.. ㅋㅋ hooni 2013.04.23 7196
524 Develop [c] 오류체크(CRC 체크 ) 소스 2 hooni 2013.04.23 8157
523 Develop [c] 오목.. 간단한 소스 ㅋㅋ file hooni 2013.04.23 9674
522 Develop [c] 웅지학원 NAT를 소스코드로.. file hooni 2013.04.23 6629
521 Develop [c] 웹 메모장.. ㅋㅋ file hooni 2013.04.23 6851
520 Develop [c] 윈도우 API sin 함수 출력.. file hooni 2013.04.23 15690
519 Develop [c] 윈도우 API Viewport와 Window file hooni 2013.04.23 5984
518 Develop [c] 유닉스 프로그램에서 인수처리 해주는 getopt() 함수 file hooni 2013.04.23 8095
Board Pagination Prev 1 ... 22 23 24 25 26 27 28 29 30 31 ... 71 Next
/ 71