Saturday 27 August 2016

L.C.M and H.C.F Program

www.programmingcalculator.com
https://nikhilnihal.github.io/programmingcalculator/index.html

C++  PROGRAM  FOR  FINDING  H.C.F.  &  L.C.M.



#include<bits/stdc++.h>
 
int main() 
{
  int a, b, x, y, t, gcd, lcm;
 
  cin>>a>>b;
 
  a = x;
  b = y;
 
  while (b != 0) {
    t = b;
    b = a % b;
    a = t;
  }
 
  gcd = a;
  lcm = (x*y)/gcd;
 
  cout<<gcd<<endl;
  cout<<hcf<<endl;
 
  return 0;
}

No comments:

Post a Comment

Uploading and Running Lambda function in AWS

Main.go package main import ( "fmt" "encoding/json" "log" "github.com/aws/aws-lambda-g...