Probability that an arbitrary positive divisor of 10 ^ X is an integral multiple of 10 ^ Y | C ++ program to find the probability of an arbitrary positive divisor of Xth power of 10 to be a multiple of Yth power of 10 ; Function to calculate and print the required probability ; Count of potential divisors of X - th power of 10 which are also multiples of Y - th power of 10 ; Count of divisors of X - th power of 10 ; Calculate GCD ; Print the reduced fraction probability ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; #define int  long long int NEW_LINE void prob ( int x , int y ) { int num = abs ( x - y + 1 ) * abs ( x - y + 1 ) ; int den = ( x + 1 ) * ( x + 1 ) ; int gcd = __gcd ( num , den ) ; cout << num / gcd << " / " << den / gcd << endl ; } signed main ( ) { int X = 2 , Y = 1 ; prob ( X , Y ) ; return 0 ; }