Views 8873 Votes 0 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();
} 

?

  1. [c] CGI Library to C^^

  2. [c] 간단한 링크드 리스트(linked list) 자료형 예제..

  3. [php] whois정보 조회 프로그램

  4. [c] 최대공약수 알고리즘 (유클릿)

  5. [c] 소수점 반올림^^

  6. [c] 하노이탑 - 재귀함수

  7. [c] 팩토리얼.. - 재귀함수

  8. [c] 간단한 채팅(클라이언트/서버) 프로그램 소스

  9. [sql] 간단한 SQL 문법 정리

  10. [c] 그래픽스 자료(OpenGL 라이브러리) 샘플 소스

  11. [opengl] 컴퓨터 그래픽스 강의 자료(수업자료)

  12. [c++] p.47 연습문제 3번

  13. [c++] p.58 연습문제 2번

  14. [c++] p.118 확인학습 5번

  15. [c] 프로그래밍 ppt, 스킬업 (비트 수업자료)

  16. [linux] 콘솔/Xwindow 에서 PC스피커 소리 없애기

Board Pagination Prev 1 2 3 4 5 ... 74 Next
/ 74