I have an array of size n. I need to find the GCD of each element with a given number and if it\'s greater than 1, add it to another array. What\'s the fastest way to do thi
#include
int main()
{
int a,b,a1,b1;
printf("Enter two numbers:");
scanf("%d%d",&a,&b);
a1=a;b1=b;
while(a!=b)
{
if(a>b)
a=a-b;
else
b=b-a;
}
printf("GCD of %d and %d is %d\n",a1,b1,a);
printf("LCM of %d and %d is %d",a1,b1,(a1*b1/a));
}