You are viewing a single comment's thread. Return to all comments →
C Programming Solution:
void countApplesAndOranges(int s, int t, int a, int b, int apples_count, int* apples, int oranges_count, int* oranges) { int count[2]={0,0}; for(int i=0; i<2;i++){ if(i==0){ for(int j=0; j<apples_count;j++){ if((a+apples[j])>=s && (a+apples[j])<=t ){ (count[i])++; } } } else{ for(int j=0; j<oranges_count;j++){ if((b+oranges[j])>=s && (b+oranges[j])<=t ){ (count[i])++; } } } } printf("%d\n%d",count[0],count[1]); }
Seems like cookies are disabled on this browser, please enable them to open this website
Apple and Orange
You are viewing a single comment's thread. Return to all comments →
C Programming Solution: