Help with assignemtn

I'm sorry if this will sound like low-level programming, but I need help completing my assignment:
I have to make a program, that would read massifs from txt files:
Massif A[n]
10 20 -100 1 2 3 4 1000 50
Massif B[m]
100 200 10 20 30 5000 100 20 -100 500
Then I need the program to show massif A[min,max] - the lowest and the highest values from massif A and the numbers between them
-100 1 2 3 4 1000
And for other massif B[1,m/2] - from the first number in the massif to the m/2 which is half of the massif
100 200 10 20 30

Last thing I need is:
A[min,max]+B[1,m/2] elements sum = 1270

So far I managed to make the program read massifs A and B and display them.
-----------------------------------------
#include <stdio.h>
void mas_spausd(FILE *,char[],float *,int short);
int short mas_ived(char[],float *,int short *);

int main()
{
char unsigned const n = 20, m = 15, l = 5;
char l_failas[20];
FILE *failas;
float suma, A[n], B[m];
int short N,M,L, max_i, min_i, i;

//-----------------------------------------------------//

if (mas_ived("Which file do you want to open massif A ?",A,&N)) return 0;
if (mas_ived("Which file do you want to open massif B ?",B,&M)) return 0;
printf("Where do you want to save results ?\n");
scanf("%s",l_failas);
failas = fopen(l_failas,"w");
fprintf(failas,"\n"); mas_spausd(failas,"A massif",A,N);
fprintf(failas,"\n"); mas_spausd(failas,"B massif",B,M);
fprintf(failas,"\n");


}
//-----------------------------------------------------//

int short mas_ived(char klausimas[],float a[], int short *n)
{ int short i;
char l_failas[20];
FILE *failas;
printf("%s\n",klausimas);
scanf("%s",l_failas);
failas = fopen(l_failas,"r");
if (failas == 0 ){
printf("cannot read file %s\n",l_failas);
return 1;
}
i = 0;
while (!feof(failas))
{
fscanf(failas,"%f",&a[i]);
i++;
}
fclose(failas);
*n = --i;
return 0;
}

void mas_spausd(FILE *fail,char antraste[],float a[],int short n)
{ short int i;
fprintf(fail,"\n\t%s\n",antraste);
for (i = 0; i <n; i++)
fprintf(fail," %.2f",a[i]);
fprintf(fail,"\n\n");

}
-----------------------------------------

End result should look like this:

Massif A
10 20 -100 1 2 3 4 1000 50
Massif B
100 200 10 20 30 5000 100 20 -100 500
A[min,max] massif elements
-100 1 2 3 4 1000
B[1,m/2] massif elements
100 200 10 20 30
A[min,max]+B[1,m/2] elements sum = 1270


I know that everyone of you is beyond this programming, but I need this really much, because my programming knowledge is low and I want to improve, but cannot figure how to write the correct program.

Thank you in advance!
massif means array
Topic archived. No new replies allowed.