Skip to content

Instantly share code, notes, and snippets.

@Sammers21
Created December 17, 2017 12:34
Show Gist options
  • Save Sammers21/e8dba31e83507d4f9e7233fe16c5db88 to your computer and use it in GitHub Desktop.
Save Sammers21/e8dba31e83507d4f9e7233fe16c5db88 to your computer and use it in GitHub Desktop.
Тестирование задание №5 Здание
//(0, 5) Покрывает из 16 строк = 2
//(0, 5) Покрывает из 12 ветвлений = 1
//(0, 5) Покрывает из 20 условий = 1
int gcd(int a, int b)
{
if(a == 0) // +
return b; // +
if(b == 0)
return a;
if(a == b)
return a;
if(a > 0 && b < 0 || a < 0 && b > 0)
b = -b;
do
{
if(b > a && a > 0 || b < a && a < 0)
{
a = b-a;
b = b-a;
a = a+b;
}
b = a-b;
a = a-b;
}
while(b != 0);
return a;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment