C Euclid algorithm EBOB

Posted: October 13, 2014 in Algorithms, C
Tags: , , ,

Euclid algorithm -> EBOB un belirlenmesi

EBOB (a,b)=ax+by;

Örnek EBOB ( 15,25) ü bulalım

25=15*1+10
15=10*1+5
10=5*2+0

EBOB = ( 15,25) =5

Aşağıdaki program kullanıcıdan iki sayı almaktadır ve yukarıda anlattığımız yöntemle EBOB u bulmaktadır.
#include
#include

int main()
{
int x,y,EBOB,r;

printf(“Enter the number1 and number2:”);
scanf(“%d %d”,&x,&y);
while(y!=0)
{

r=x;
x=y;
y=r%y;

}

EBOB =x;
printf(“iki sayinin EBOB’u::”);
printf(“%d”, EBOB);

}
——————————————————————————————————————–

32

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s