Develop
2003.04.23 09:45
[c] 최대공약수 알고리즘 (유클릿)
조회 수 8875 댓글 0
# 최대 공약수 구하는 함수
#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(); }
-
[c] 약수/최대공약수/완전수 알고리즘
-
[c] 최대공약수 알고리즘 (유클릿)
-
[js] jQjuery $ 활용
-
[c++] 채팅로봇 소스.. ㅋㄷㅋㄷ
-
[c++] 바탕화면 테두리에 자석처럼 붙는 스냅효과..
-
[js] 밀리터리 프로그램(전역일 계산)
-
[js] 객체 머지..
-
[c][java] 주사선 채우기 알고리즘(scan line filling algorithm) 구현
-
[c] 간단한 채팅(클라이언트/서버) 프로그램 소스
-
[c] OpenGL 직사각형(2D) 크기 확대/축소
-
[c] 디피-헬만 키교환(Diffie–Hellman key exchange) 샘플 코드.. ㅋㄷ
-
[linux] 간단한 find 명령어 설명(업데이트 해야 함)