Write a program  that allows the calculation of the greatest common divisor (GCD) between two integers entered by the user.     For example:      M= 15    et    N=10     GCD (15 , 10) =  5 


******** In Algorithm ********

Algorithm Variables i,N,M, Common_div : integers Begin write("Enter tow integers :") read(N,M) i ← 1 while (i<=N and i<=M ) if ( N % i=0 and M % i=0) then Common_div ← i next i←i+1 nexte write ("the GCD is :", Common_div) End Result ==> Enter tow integers : 20 15 the GCD is : 5


******** In C ********

#include<stdio.h> int main(){ int i=1,N,M,common_div; printf("Enter an integer :"); scanf("%d",&N); printf("Enter an integer :"); scanf("%d",&M); while(i<=N && i<=M ){ if ( N%i==0 && M%i==0){ common_div = i ; } i++; } printf(" GCD(%d,%d)= %d",M,N,common_div); return 0; }


******** In C++ ********

#include <iostream> using namespace std; int main(){ int i=1,N,M, common_div; cout<<" Enter an integer :"; cin>>N; cout<<" Enter an integer :"; cin>>M; while(i<=N && i<=M ){ if ( N%i==0 && M%i==0){ common_div = i ; } i++; } cout<<" GCD("<<M<<","<<N<<")="<< common_div; return 0; }