Solution : In the given problem, we can see that first number ‘a’ can be handled by long long int data type but second number ‘b’ can not be handled by any int data type. Here we read second number as a string and we will try to make it less than and equal to ‘a’ by taking it’s modulo with ‘a’.
Below is implementation of the above idea.
// C++ program to find GCD of two numbers such that
// the second number can be very large.
// function to find gcd of two integer numbers
ll gcd(ll a, ll b)
// Here 'a' is integer and 'b' is string.
// The idea is to make the second number (represented
This article is contributed by Shashank Mishra (Gullu).This article is reviewed by team GeeksforGeeks . Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.