#include<iostream.h>
#include<conio.h>
int n1, n2, a, hcf;
void main()
{
cout<<"Enter two numbers : ";
cin>>n1>>n2;
if(n1<n2)
a=n1;
else
a=n2;
for(int i=a; i>=1 ; i--)
{
if(n1%i==0 && n2%i==0)
{
hcf=i;
break;
}
}
cout<<"\nHCF = "<<hcf;
getch();
}
.................................................................
OUTPUT :(click to enlarge the image)
I like your blog.
ReplyDeleteKeep up posting so nicely !
:)