Write a program that asks the user to enter two integers, then calculates and displays their greatest common divisor (GCD).
寫一個輸入兩個整數 輸出它們的最大公因數程式
Hint: Use Euclidean Algorithm
使用歐幾里得演算法
Example input:
12 28
Example output:
4
Hidden content!*** * ** ** * ** * int main (void){int a,b,c; ** * ** ** * * * *** ** * * * * ** * * ** * ** while ( a % b != 0){* * * * *** * * *** ** * ** * * ***** * ** * ** ** * * ** * ** * * * * ***** * ** ** } * ** ** * ** * * ** ** * 0;}
Hidden content!#include<stdio.h>#define swap(a,b) { a^=b, b^=a, a^=b; }int main(){