Skip to content

Instantly share code, notes, and snippets.

@gushogg-blake
Created April 23, 2020 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gushogg-blake/042adc37e22a82d81d240bc5fd3b4890 to your computer and use it in GitHub Desktop.
Save gushogg-blake/042adc37e22a82d81d240bc5fd3b4890 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main() {
int arr[] = { 3, 4, 2, 1, 5, 6 };
int winter_high[6] = { NULL };
int overall_high[6] = { NULL };
int j,k;
j = 0;
k = 0;
winter_high[0] = arr[0];
overall_high[0] = arr[0];
for (int i = 0; i < 6 ; i++)
{
if (arr[i] <= winter_high[j])
{
winter_high[j] = arr[i];
j++;
}
else if (arr[i] > overall_high[k])
{
overall_high[k] = arr[i];
k++;
}
}
printf("The length of the winter sub array: %d\n", j);
printf("The length of the summer sub array: %d\n", k);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment