#include <stdio.h>

main ()
{ 
  int a,b,num1,num2,num3,r;
  printf("Enter Two Numbers:\n");
  scanf("%d %d",&a,&b);
  
  if(a<b)
  {
      num1=a;
      num2=b;
  }else
  {
      num1=b;
      num2=a;
  }
  
  r=num2%num1;
  
 while(r!=0)
 {
  num2=num1;
  num1=r;
  r=num2%num1;
 }
 
  num3=(a*b)/num1;
  printf("GCD=%d\n",num1);
  printf("LCM=%d",num3);
  
}

     
           
Note: Need to be arranged in compiler after copied
   

 OutPut:

Enter Two Numbers: 45 15 GCD=15 LCM=45