#include
int square(int i )
{
return i*i;
}
void main()
{
int s=square(2)+square(10)+square(623);
printf("%d",s);
}希臘數(shù)學(xué)家Euclid研究了求兩個整數(shù)的最大公約數(shù)的算法。對于兩個整數(shù)integer1和integer2,算法如下:①如果integer1/integer2的余數(shù)為0,那么integer2就是最大公約數(shù);②如果余數(shù)不為0,那么將integer2賦值給integer1,余數(shù)賦值給integer2;③從步驟①重復(fù)執(zhí)行。編寫一個程序來實現(xiàn)這個算法。它使用兩個整型參數(shù),并返回最大公約數(shù)程序還是自己寫才有鍛煉效果,望樓主能在編程上有好的成績。下面的程序是實現(xiàn)過程,運行沒一點問題。比如你輸入8,12,結(jié)果是4,也就是二者的最大公約數(shù)是4.#include