Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //C Program to Find GCD and LCM of two Numbers.
- #include<stdio.h>
- int main(){
- int x1,x2,mod,num1,num2,gcd;
- printf("Enter Two Number :");
- scanf("%d%d",&x1,&x2);
- num1=x1;
- num2=x2;
- while(num2!=0){
- mod = num1%num2;
- num1 = num2;
- num2 = mod;
- }
- printf("GCD of two number is :%d\n",num1);
- printf("LCM of two number is :%d\n",((x1*x2)/num1));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment