diff --git a/balanced.cpp b/balanced.cpp new file mode 100644 index 0000000..52aaeac --- /dev/null +++ b/balanced.cpp @@ -0,0 +1,40 @@ +/'Given an integer N which has odd number of digits, +find whether the given number is a balanced or not. +An odd digit number is called a balanced number if the sum of all digits to the left +of the middle digit and the sum of all digits to the right of the middle digit is equal. '/ + +#include +using namespace std; + +class Solution{ +public: + bool balancedNumber(string N) + { + // code here + if(N.size() % 2 == 0){return false;} + int mid = N.size()/2; + int sum1 = 0,sum2 = 0; + for(int i=0;i>t; + while(t--) + { + string N; + cin>>N; + Solution ob; + cout<