Program to find greater value between a ^ n and b ^ n | C ++ code for finding greater between the a ^ n and b ^ n ; Function to find the greater value ; If n is even ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void findGreater ( int a , int b , int n ) { if ( ! ( n & 1 ) ) { a = abs ( a ) ; b = abs ( b ) ; } if ( a == b ) cout << " a ^ n ▁ is ▁ equal ▁ to ▁ b ^ n " ; else if ( a > b ) cout << " a ^ n ▁ is ▁ greater ▁ than ▁ b ^ n " ; else cout << " b ^ n ▁ is ▁ greater ▁ than ▁ a ^ n " ; } int main ( ) { int a = 12 , b = 24 , n = 5 ; findGreater ( a , b , n ) ; return 0 ; }