Counts 1 s that can be obtained in an Array by performing given operations | C ++ program to implement the above approach ; Function to count total number of 1 s in array by performing the given operations ; Stores count of 1 s in the array by performing the operations ; Update cntOnes ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int cntOnesArrWithGivenOp ( int arr [ ] , int N ) { int cntOnes = 0 ; cntOnes = sqrt ( N ) ; return cntOnes ; } int main ( ) { int arr [ ] = { 0 , 0 , 0 , 0 , 0 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << cntOnesArrWithGivenOp ( arr , N ) ; return 0 ; }