Hello I'm new here and I would like to say that I usually find this forum useful for my C issues but not with the last one...

I'm (trying to) graduate at university of Rome in informatics but I suck in math! I'm used to be a good programmer but not when advanced (for me at least) math is required.

I'm trying to do my best but I really need some help with this problem. I'll paste the exercise to you:

Write a C program that reads 10 integers (positives, negatives or zero) and another one integer (k) and stamps:
1. How many times the k number appears next of one number < of k among the 10 integers (if the first number received is = k that this number must be counted also).
2. How many times the k number appears previous of one number > k among the 10 integers (if the tenth number received is = k that number must be considered also)

Example1:
9, -7, 23, 8, 9, 9, 13, 9, -11, 5, 9
The program must stamps:
2, 1

Example2:
-5, 0, 3, 17, -998, 0, -12, 0, 0, 0, 0
The program must stamps:
3, 2

I'm sorry if the translation may not be correct but I'll try to explain better if needed. I'll paste my program (that obviously doesn't work properly) and next the program made by a friend of mine I used as a little guide.

#include <stdio.h>

int a[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int b;
int mins = 0;
int mags = 0;
int i = 1;

Code:
int main()
{
	for( i == 1 ; i < 11 ; i++ ) {
		scanf( "%d" , &a[i] );
	}

	scanf( "%d" , &b );

	i--;

	for( i == 9 ; i > 0 ; i-- ) {
		if( a[i-1] == b ) {
			mins++;
			printf("il vettore %d (%d) si mins++\n" , i , a[i]);
		}
	}

	i++;

	for( i == 0 ; i < 11 ; i++ ) {
		if( a[i+1] == b ) {
			mags++;
		}
	}

	printf( "%d %d" , mins , mags );

	return 0;
}
Code:
#include <stdio.h>

int Vector[ 10 ];
int i=0;
int j=0;
int numKMagg=0;
int numKMin=0;

int main()
{
	while( i<11 )
	{
		scanf("%d", &Vector[i]);
        i++;
	}
	
	while( j<9 )
	{
		if( Vector[j+1] == Vector[10] )
		{
			if( Vector[j+1] > Vector[j] )
			numKMagg++;
		}
	    
		if( Vector[j-1] == Vector[10] )
		{
			if( Vector[j-1] < Vector[j] )
			numKMin++;
		}
		
		j++;
	}

	if( Vector[0] == Vector[10] )
	numKMagg++;
	
    if( Vector[9] == Vector[10] )
    numKMin++;
    
    
    printf("%d\n%d\n",numKMagg, numKMin); 
     	
	return 0;
	
}
His works, mine not...

Please help me.

Thanks in advance.