You are viewing a single comment's thread. Return to all comments →
public static void countApplesAndOranges(int s, int t, int a, int b, List<int> apples, List<int> oranges) { int appleIncCount =0; int orangeIncCount =0; for(int i=0;i<apples.Count;i++){ if((apples[i] + a) >= s && (apples[i] + a) <= t ){ appleIncCount++; } } for(int i=0;i<oranges.Count;i++){ if((oranges[i] + b) >= s && (oranges[i] + b) <= t ){ orangeIncCount++; } } Console.WriteLine(appleIncCount); Console.WriteLine(orangeIncCount); }
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 →