C/C++ Program for Euclids Algorithm for Finding GCD of Two Numbers
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c,i,j,k;
clrscr();
cout<<"\n\t\t *** Euclids Algorithm to Find GCD ***\n\n";
cout<<"\nEnter First Number :: ";
cin>>a;
cout<<"\nEnter Second Number :: ";
cin>>b;
if(a<b);
{
k=a;
a=b;
b=k;
}
c=b;
while(b>0)
{
c=a%b;
a=b;
b=c;
}
cout<<"\nGCD of Two Nos. :: "<<a;
getch();
}