3 | C ++ implementation of the approach ; Function that returns true if n is an Osiris number ; 3 rd digit ; 2 nd digit ; 1 st digit ; Check the required condition ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool isOsiris ( int n ) { int a = n % 10 ; int b = ( n / 10 ) % 10 ; int c = n / 100 ; int digit_sum = a + b + c ; if ( n == ( 2 * ( digit_sum ) * 11 ) ) { return true ; } return false ; } int main ( ) { int n = 132 ; if ( isOsiris ( n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }