Created
April 23, 2020 07:21
-
-
Save gushogg-blake/042adc37e22a82d81d240bc5fd3b4890 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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