What do you want to save?
Add Code snippet
New code examples
-
VBA 2021-10-30 02:36:13
excel vba greatest common denominator
'VBA function to find the Greatest Common Denominator of two numbers: Function GCD(ByVal a, ByVal b) '<--Euclid's algorithm a = Abs(a): b = Abs(b) While b If a > b Then a = a - b Else b = b - a Wend GCD = a End Function... Add solution -
-
Javascript 2021-10-28 16:10:09
javascript reduce fraction
// Reduce a fraction by finding the Greatest Common Divisor and dividing by it. function reduce(numerator,denominator){ var gcd = function gcd(a,b){ return b ? gcd(b, a%b) : a; }; gcd = gcd(numerator,denominator); return [numerator/gcd, denomi... Add solution -
Java 2021-10-25 07:12:14
a recursive function that calculates the greatest common divisor from user's input in java
/** * Java program to demonstrate How to find Greatest Common Divisor or GCD of * two numbers using Euclid’s method. There are other methods as well to * find GCD of two number in Java but this example of finding GCD of two number * is most si... Add solution -
C++ 2021-10-23 21:19:09
array filling problem code arrfill
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while(t--) { ll n, m; cin>>n>>m; vector<pair<... Add solution -
Other 2021-10-12 22:03:04
latex how to write algorithm pseudocode
% in the header: % \usepackage{algorithm} % \usepackage{algpseudocode} % in the body: \begin{algorithm} \caption{Euclid’s algorithm} \label{euclid} \begin{algorithmic}[1] \Require $x\ge5$ \Ensure $x\le-5$ \Function{Euclid}{$a,b$}... Add solution