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();
} 

?

No Articles

Board Pagination Prev 1 ... 49 50 51 52 53 Next
/ 53