LCM of Two Numbers using Command Line Language

Ques. Find the LCM of two Numbers using Command Line Language?

It is highly advisable to go through Command Line Arguments Post before even looking at the code. Please study this for TCS and come back to this post later.

Also, write your version of code in the comments –

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char * argv[])
  int n1,n2,x,y;
  if (argc == 1 || argc > 3)
    printf("Enter Two Number\r\n");
  n1 = x; n2 = y;
  printf("L.C.M of %d & %d = %d \r\n",x,y,x*y/n1);
  return 0;


Prepare Better for Placement Papers