Maximum OR sum of sub | C # program to find maximum OR sum ; function to find maximum OR sum ; OR sum of all the elements in both arrays ; Driver code
using System ; class GFG { static void MaximumSum ( int [ ] a , int [ ] b , int n ) { int sum1 = 0 , sum2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum1 |= a [ i ] ; sum2 |= b [ i ] ; } Console . WriteLine ( sum1 + sum2 ) ; } public static void Main ( ) { int [ ] A = { 1 , 2 , 4 , 3 , 2 } ; int [ ] B = { 2 , 3 , 3 , 12 , 1 } ; int n = A . Length ; MaximumSum ( A , B , n ) ; } }