
/* Tali Newman
   CPSC 1011, Spring 2023
   lab 4
   arrays 
*/ 

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void){

	int array1[] = 20, array2[] = 20;

	for (int i = 0; i<array1; i++){
		printf("enter 20 integers");
		scanf("%i", &array1[i]);

		array1++;

	}//end for loop

	for (int i=0; i<array1; i++){
		printf("%d\n", array1[i]);

	}//end for loop 2

	for (int i=0; i<array2; i++){
		array2[i] = (rand() % 100) + 1;
	        i++;

	}//end for loop 3

	for (int i=0; i<array2; i++){
		printf("%d\n", array2[i]);
		
	}//end for loop 4

	int max1;
	for (int i=0; i<20; i++){
		array1[i]=(rand() % 100) + 10;
		max1 = array1[i];

		for (int i=1; i<100; i++){
			if (array1[i]>max1){
				max1 = array1[i];
			}//end if

	}//end for loop 5
	
	printf("Max = %d\n", max1);

	int max2;
        for (int i=0; i<20; i++){
                array2[i]=(rand() % 100) + 10;
                max2 = array2[i];

                for (int i=1; i<100; i++){
                        if (array2[i]>max2){
                                max2 = array2[i];
                        }//end if

        }//end for loop 5

        printf("Max = %d\n", max2);

}//end main
