Develop
2003.04.23 09:45
[c] 최대공약수 알고리즘 (유클릿)
조회 수 10450 댓글 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();
}
-
Read More
[sql] 간단한 SQL 문법 정리
-
Read More
[c] 간단한 채팅(클라이언트/서버) 프로그램 소스
-
Read More
[c] 팩토리얼.. - 재귀함수
-
Read More
[c] 하노이탑 - 재귀함수
-
Read More
[c] 소수점 반올림^^
-
Read More
[c] 최대공약수 알고리즘 (유클릿)
-
Read More
[php] whois정보 조회 프로그램
-
Read More
[c] 간단한 링크드 리스트(linked list) 자료형 예제..
-
Read More
[c] CGI Library to C^^
-
Read More
[c] scanf(), printf() 포맷의 형변환
-
Read More
[c] home env stack overflow
-
Read More
[c] 파일입출력 간단한 설명