Wednesday, February 1, 2012

Enter Two digits by a user and get its LCM

#include<stdio.h> 
#include<conio.h> 
void main() 

int x,y,i,j; 
clrscr(); 
printf("Enter Two Digits"); 
scanf("d",&x,&y); 

for(i=1;i<=x;i++) 

for(j=1;j<=y;j++) 

if(y*i==x*j) 

printf("LCM is %d\n",y*i); 
i=i+x; 



getch(); 


No comments:

Post a Comment