Driver program
int main ( ) { int a [ ] = { 1 , 1 , 2 , 1 , 3 , 4 , 5 , 2 , 8 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; Query q [ ] = { { 0 , 4 } , { 1 , 3 } , { 2 , 4 } } ; int m = sizeof ( q ) / sizeof ( q [ 0 ] ) ; printQuerySums ( a , n , q , m ) ; return 0 ; }